Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190607072704.GA25229@mwanda

authored by

Dan Carpenter and committed by
Andrzej Hajda
955f03a7 35ab6cfb

+2 -2
+2 -2
drivers/gpu/drm/bridge/sii902x.c
··· 599 599 if (ret) 600 600 goto out; 601 601 602 - for (i = 0; sii902x->audio.i2s_fifo_sequence[i] && 603 - i < ARRAY_SIZE(sii902x->audio.i2s_fifo_sequence); i++) 602 + for (i = 0; i < ARRAY_SIZE(sii902x->audio.i2s_fifo_sequence) && 603 + sii902x->audio.i2s_fifo_sequence[i]; i++) 604 604 regmap_write(sii902x->regmap, 605 605 SII902X_TPI_I2S_ENABLE_MAPPING_REG, 606 606 sii902x->audio.i2s_fifo_sequence[i]);