Skip to content

Commit 54a11ce

Browse files
Jie1zhanggregkh
authored andcommitted
drm/amdgu: fix Unintentional integer overflow for mall size
[ Upstream commit c09d2ef ] Potentially overflowing expression mall_size_per_umc * adev->gmc.num_umc with type unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic,and then used in a context that expects an expression of type u64 (64 bits, unsigned). Signed-off-by: Jesse Zhang <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 69f397e commit 54a11ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ static int amdgpu_discovery_get_mall_info(struct amdgpu_device *adev)
15501550
break;
15511551
case 2:
15521552
mall_size_per_umc = le32_to_cpu(mall_info->v2.mall_size_per_umc);
1553-
adev->gmc.mall_size = mall_size_per_umc * adev->gmc.num_umc;
1553+
adev->gmc.mall_size = (uint64_t)mall_size_per_umc * adev->gmc.num_umc;
15541554
break;
15551555
default:
15561556
dev_err(adev->dev,

0 commit comments

Comments
 (0)