drm/amdgu: fix Unintentional integer overflow for mall size
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:44:41 +0000 (09:44 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:44:41 +0000 (09:44 +0000)
From Jesse Zhang
54a11ce4ff2a01fc2a231c546a864883633d2b97 in linux-6.6.y/6.6.50
c09d2eff81a997c169e0cacacd6b60c5e3aa33f2 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_discovery.c

index 0a03218..c10dbf3 100644 (file)
@@ -1567,7 +1567,7 @@ static int amdgpu_discovery_get_mall_info(struct amdgpu_device *adev)
                break;
        case 2:
                mall_size_per_umc = le32_to_cpu(mall_info->v2.mall_size_per_umc);
-               adev->gmc.mall_size = mall_size_per_umc * adev->gmc.num_umc;
+               adev->gmc.mall_size = (uint64_t)mall_size_per_umc * adev->gmc.num_umc;
                break;
        default:
                dev_err(adev->dev,