Commit 955f03a7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Andrzej Hajda

drm/bridge: sii902x: re-order conditions to prevent out of bounds read

This should check that "i" is within bounds before checking reading from
the array.

Fixes: ff578163 ("drm/bridge: sii902x: Implement HDMI audio support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190607072704.GA25229@mwanda
parent 35ab6cfb
......@@ -599,8 +599,8 @@ static int sii902x_audio_hw_params(struct device *dev, void *data,
if (ret)
goto out;
for (i = 0; sii902x->audio.i2s_fifo_sequence[i] &&
i < ARRAY_SIZE(sii902x->audio.i2s_fifo_sequence); i++)
for (i = 0; i < ARRAY_SIZE(sii902x->audio.i2s_fifo_sequence) &&
sii902x->audio.i2s_fifo_sequence[i]; i++)
regmap_write(sii902x->regmap,
SII902X_TPI_I2S_ENABLE_MAPPING_REG,
sii902x->audio.i2s_fifo_sequence[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment