Skip to content

Commit b1fb056

Browse files
timhuang-amdsmb49
authored andcommitted
drm/amdgpu: fix ucode out-of-bounds read warning
BugLink: https://bugs.launchpad.net/bugs/2081279 [ Upstream commit 8944acd ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 1d70653 commit b1fb056

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)