Skip to content

Commit 5fe8d1d

Browse files
committed
drm/i915/dsi: Fix overflow issue in pclk parsing
Parsed divider p will overflow and is considered being valid in case pll_ctl == 0. Fix this by checking divider p before decreasing it. Also small improvement is made by using fls() instead of custom loop. v2: use fls() and check parsed divider Signed-off-by: Jouni Högander <jouni.hogander@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: https://lore.kernel.org/r/20250807042635.2491537-1-jouni.hogander@intel.com
1 parent f9b5bf7 commit 5fe8d1d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/gpu/drm/i915/display/vlv_dsi_pll.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ static int vlv_dsi_pclk(struct intel_encoder *encoder,
142142
pll_div &= DSI_PLL_M1_DIV_MASK;
143143
pll_div = pll_div >> DSI_PLL_M1_DIV_SHIFT;
144144

145-
while (pll_ctl) {
146-
pll_ctl = pll_ctl >> 1;
147-
p++;
148-
}
149-
p--;
145+
p = fls(pll_ctl);
146+
if (p)
147+
p--;
150148

151149
if (!p) {
152150
drm_err(display->drm, "wrong P1 divisor\n");

0 commit comments

Comments
 (0)