Skip to content

Commit 8944acd

Browse files
timhuang-amdalexdeucher
authored andcommitted
drm/amdgpu: fix ucode out-of-bounds read warning
Clear warning that read ucode[] may out-of-bounds. Signed-off-by: Tim Huang <Tim.Huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent f683f24 commit 8944acd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
213213
struct amdgpu_firmware_info *ucode;
214214

215215
id = fw_type_convert(cgs_device, type);
216+
if (id >= AMDGPU_UCODE_ID_MAXIMUM)
217+
return -EINVAL;
218+
216219
ucode = &adev->firmware.ucode[id];
217220
if (ucode->fw == NULL)
218221
return -EINVAL;

0 commit comments

Comments
 (0)