]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/msm/dpu: cast crtc_clk calculation to u64 in _dpu_core_perf_calc_clk()
authorZichen Xie <zichenxie0106@gmail.com>
Tue, 29 Oct 2024 19:42:10 +0000 (14:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:19 +0000 (13:53 +0100)
commit1373043bdbea1bb6ea194bf9e17e6d2ac09a8b28
treeecea039d1998731ae313ea62cdf7c9e3ad4bd6a8
parent0ec90ac5f7bd9dd573bd5d964cbdc3beaa93a33e
drm/msm/dpu: cast crtc_clk calculation to u64 in _dpu_core_perf_calc_clk()

[ Upstream commit 20c7b42d9dbd048019bfe0af39229e3014007a98 ]

There may be a potential integer overflow issue in
_dpu_core_perf_calc_clk(). crtc_clk is defined as u64, while
mode->vtotal, mode->hdisplay, and drm_mode_vrefresh(mode) are defined as
a smaller data type. The result of the calculation will be limited to
"int" in this case without correct casting. In screen with high
resolution and high refresh rate, integer overflow may happen.
So, we recommend adding an extra cast to prevent potential
integer overflow.

Fixes: c33b7c0389e1 ("drm/msm/dpu: add support for clk and bw scaling for display")
Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/622206/
Link: https://lore.kernel.org/r/20241029194209.23684-1-zichenxie0106@gmail.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c