aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c
diff options
context:
space:
mode:
authorAlex Hung <[email protected]>2024-06-08 04:09:53 +0000
committerAlex Deucher <[email protected]>2024-07-01 20:06:53 +0000
commitbbd0d1c942cbac87404ed2bca0aa4f7907b8f47f (patch)
treeb5d6ff653f2dab7da511791b8ae020b9081dc842 /drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c
parentdrm/amd/display: Add ASIC cap to limit DCC surface width (diff)
downloadkernel-bbd0d1c942cbac87404ed2bca0aa4f7907b8f47f.tar.gz
kernel-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 <[email protected]> Signed-off-by: Jerry Zuo <[email protected]> Signed-off-by: Alex Hung <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c')
-rw-r--r--drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c
index b30c2cdc1a61..e47e9db062f4 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c
@@ -1853,7 +1853,7 @@ static void calculate_bandwidth(
/*compute total time to request one chunk from each active display pipe*/
for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
if (data->enable[i]) {
- data->chunk_request_time = bw_add(data->chunk_request_time, (bw_div((bw_div(bw_int_to_fixed(pixels_per_chunk * data->bytes_per_pixel[i]), data->useful_bytes_per_request[i])), bw_min2(sclk[data->sclk_level], bw_div(data->dispclk, bw_int_to_fixed(2))))));
+ data->chunk_request_time = bw_add(data->chunk_request_time, (bw_div((bw_div(bw_int_to_fixed(pixels_per_chunk * (int64_t)data->bytes_per_pixel[i]), data->useful_bytes_per_request[i])), bw_min2(sclk[data->sclk_level], bw_div(data->dispclk, bw_int_to_fixed(2))))));
}
}
/*compute total time to request cursor data*/