]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix shift-out-of-bounds when updating umc active mask
authorHawking Zhang <Hawking.Zhang@amd.com>
Wed, 28 Jan 2026 10:53:40 +0000 (18:53 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 Mar 2026 17:58:08 +0000 (13:58 -0400)
UMC node_inst_num can exceed 32, causing
(1 << node_inst_num) to shift a 32-bit int
out of bounds

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

index 2669b0346a60bd9abef8ee23f64433681d5e723d..5f8f0c84166666f3db91ef5b6492b8d5d26979e3 100644 (file)
@@ -793,7 +793,7 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
        struct harvest_table *harvest_info;
        u16 offset;
        int i;
-       uint32_t umc_harvest_config = 0;
+       u64 umc_harvest_config = 0;
 
        if (amdgpu_discovery_get_table_info(adev, &info, HARVEST_INFO))
                return;
@@ -850,7 +850,7 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
                }
        }
 
-       adev->umc.active_mask = ((1 << adev->umc.node_inst_num) - 1) &
+       adev->umc.active_mask = ((1ULL << adev->umc.node_inst_num) - 1ULL) &
                                ~umc_harvest_config;
 }