projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
11d2432
)
drm/bridge: ti-sn65dsi86: Avoid possible buffer overflow
author
Su Hui
<suhui@nfschina.com>
Thu, 8 Jun 2023 01:24:43 +0000
(09:24 +0800)
committer
Douglas Anderson
<dianders@chromium.org>
Tue, 13 Jun 2023 18:00:56 +0000
(11:00 -0700)
Smatch error:buffer overflow 'ti_sn_bridge_refclk_lut' 5 <= 5.
Fixes:
cea86c5bb442
("drm/bridge: ti-sn65dsi86: Implement the pwm_chip")
Signed-off-by: Su Hui <suhui@nfschina.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link:
https://patchwork.freedesktop.org/patch/msgid/20230608012443.839372-1-suhui@nfschina.com
drivers/gpu/drm/bridge/ti-sn65dsi86.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index
7a74878
..
4676cf2
100644
(file)
--- a/
drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/
drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@
-298,6
+298,10
@@
static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata)
if (refclk_lut[i] == refclk_rate)
break;
+ /* avoid buffer overflow and "1" is the default rate in the datasheet. */
+ if (i >= refclk_lut_size)
+ i = 1;
+
regmap_update_bits(pdata->regmap, SN_DPPLL_SRC_REG, REFCLK_FREQ_MASK,
REFCLK_FREQ(i));