diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-06-07 10:27:04 +0300 |
---|---|---|
committer | Andrzej Hajda <a.hajda@samsung.com> | 2019-06-07 15:01:18 +0200 |
commit | 955f03a7d0738bd373d69f76191b9a66adb3255c (patch) | |
tree | 95957d5e239518c0294ac10d3c8b001ad4401df8 /drivers | |
parent | 35ab6cfbf21178d4dd93d1fe4cb1416c1d6b566d (diff) | |
download | linux-stable-955f03a7d0738bd373d69f76191b9a66adb3255c.tar.gz linux-stable-955f03a7d0738bd373d69f76191b9a66adb3255c.tar.bz2 linux-stable-955f03a7d0738bd373d69f76191b9a66adb3255c.zip |
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
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/bridge/sii902x.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 961abc94d7a7..dea784b39abc 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -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]); |