Skip to content
Unverified Commit 82a1356a authored by Samuel Holland's avatar Samuel Holland Committed by Maxime Ripard
Browse files

drm/sun4i: dsi: Prevent underflow when computing packet sizes



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: default avatarSamuel Holland <samuel@sholland.org>
Reviewed-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220812031623.34057-1-samuel@sholland.org
parent 2a29f80e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment