[lvc-project] [PATCH] drm/bridge: tc358767: prevent overflow in PLL calculation

Fedor Pchelkin pchelkin at ispras.ru
Mon Aug 31 11:46:31 MSK 2026


On Fri, 28. Aug 09:42, Dmitriy Okunev wrote:
> In the tc_pxl_pll_calc() function, the expression `pixelclock *
> ext_div[i_pre] * ext_div[i_post] * div` is calculated using
> 32‑bit arithmetic, since all operands are of type u32 or int.
> 
> pixelclock takes the maximum value of 154 MHz (in accordance
> with tc_edp_mode_valid()), ext_div[...] takes the value 7, and
> div ranges from 1 to 16, inclusive. The maximum product
> (154,000,000 * 7 * 7 * 16) is approximately 1.2e11, which is much
> larger than UINT32_MAX, leading to an overflow and, as a result,
> to an incorrect value of the PLL multiplier.
> 
> Fix this by casting `pixelclock` to `u64` before the multiplication,
> ensuring all arithmetic is performed in 64-bit precision.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 7caff0fc4296 ("drm/bridge: tc358767: Add DPI to eDP bridge driver")
> Signed-off-by: Dmitriy Okunev <dokunevdmitriy at gmail.com>

Для 5.10 и 6.1 веток просьбы выслать применяемую к ним версию патча только
в lvc-patches at linuxtesting.org, указав целевые ветки в теме письма.



More information about the lvc-project mailing list