Skip to content

Commit 95011f2

Browse files
Su Huidianders
authored andcommitted
drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow
Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5. Fixes: cea86c5 ("drm/bridge: ti-sn65dsi86: Implement the pwm_chip") Signed-off-by: Su Hui <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Douglas Anderson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 11d2432 commit 95011f2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata)
298298
if (refclk_lut[i] == refclk_rate)
299299
break;
300300

301+
/* avoid buffer overflow and "1" is the default rate in the datasheet. */
302+
if (i >= refclk_lut_size)
303+
i = 1;
304+
301305
regmap_update_bits(pdata->regmap, SN_DPPLL_SRC_REG, REFCLK_FREQ_MASK,
302306
REFCLK_FREQ(i));
303307

0 commit comments

Comments
 (0)