summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc/spl
diff options
context:
space:
mode:
authorAlex Hung <alex.hung@amd.com>2024-06-07 22:09:53 -0600
committerAlex Deucher <alexander.deucher@amd.com>2024-07-01 16:06:53 -0400
commitbbd0d1c942cbac87404ed2bca0aa4f7907b8f47f (patch)
treeb5d6ff653f2dab7da511791b8ae020b9081dc842 /drivers/gpu/drm/amd/display/dc/spl
parent95134e5852978a92d2290a3b1ee93189e75507ac (diff)
downloadlinux-bbd0d1c942cbac87404ed2bca0aa4f7907b8f47f.tar.gz
linux-bbd0d1c942cbac87404ed2bca0aa4f7907b8f47f.tar.bz2
linux-bbd0d1c942cbac87404ed2bca0aa4f7907b8f47f.zip
drm/amd/display: Fix possible overflow in integer multiplication
[WHAT & HOW] Integer multiplies integer may overflow in context that expects an expression of unsigned/siged long long (64 bits). This can be fixed by casting integer to unsigned/siged long long to force 64 bits results. This fixes 26 OVERFLOW_BEFORE_WIDEN issues reported by Coverity. Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Jerry Zuo <jerry.zuo@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/spl')
-rw-r--r--drivers/gpu/drm/amd/display/dc/spl/dc_spl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/spl/dc_spl.c b/drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
index ac58991eebbc..e3e20cd86af6 100644
--- a/drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
+++ b/drivers/gpu/drm/amd/display/dc/spl/dc_spl.c
@@ -110,21 +110,21 @@ static struct spl_rect calculate_plane_rec_in_timing_active(
struct fixed31_32 temp;
- temp = dc_fixpt_from_fraction(rec_in->x * stream_dst->width,
+ temp = dc_fixpt_from_fraction(rec_in->x * (long long)stream_dst->width,
stream_src->width);
rec_out.x = stream_dst->x + dc_fixpt_round(temp);
temp = dc_fixpt_from_fraction(
- (rec_in->x + rec_in->width) * stream_dst->width,
+ (rec_in->x + rec_in->width) * (long long)stream_dst->width,
stream_src->width);
rec_out.width = stream_dst->x + dc_fixpt_round(temp) - rec_out.x;
- temp = dc_fixpt_from_fraction(rec_in->y * stream_dst->height,
+ temp = dc_fixpt_from_fraction(rec_in->y * (long long)stream_dst->height,
stream_src->height);
rec_out.y = stream_dst->y + dc_fixpt_round(temp);
temp = dc_fixpt_from_fraction(
- (rec_in->y + rec_in->height) * stream_dst->height,
+ (rec_in->y + rec_in->height) * (long long)stream_dst->height,
stream_src->height);
rec_out.height = stream_dst->y + dc_fixpt_round(temp) - rec_out.y;