drm/sun4i: dsi: Prevent underflow when computing packet sizes
stable inclusion from stable-v5.10.138 commit a1e7908f78f5a7f53f8cd83c7dcdfec974c95f26 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a1e7908f78f5a7f53f8cd83c7dcdfec974c95f26 -------------------------------- [ Upstream commit 82a1356a ] Currently, the packet overhead is subtracted using unsigned arithmetic. With a short sync pulse, this could underflow and wrap around to near the maximal u16 value. Fix this by using signed subtraction. The call to max() will correctly handle any negative numbers that are produced. Apply the same fix to the other timings, even though those subtractions are less likely to underflow. Fixes: 133add5b ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller support") Signed-off-by: NSamuel Holland <samuel@sholland.org> Reviewed-by: NJernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: NMaxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220812031623.34057-1-samuel@sholland.orgSigned-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com> Reviewed-by: NWei Li <liwei391@huawei.com>
Showing
想要评论请 注册 或 登录