drm/amdgpu: fix ucode out-of-bounds read warning
[ Upstream commit 8944acd0f9db33e17f387fdc75d33bb473d7936f ] 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>
This commit is contained in:
parent
55710990e4
commit
82f9c43def
1 changed files with 3 additions and 0 deletions
|
@ -213,6 +213,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
|
||||||
struct amdgpu_firmware_info *ucode;
|
struct amdgpu_firmware_info *ucode;
|
||||||
|
|
||||||
id = fw_type_convert(cgs_device, type);
|
id = fw_type_convert(cgs_device, type);
|
||||||
|
if (id >= AMDGPU_UCODE_ID_MAXIMUM)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
ucode = &adev->firmware.ucode[id];
|
ucode = &adev->firmware.ucode[id];
|
||||||
if (ucode->fw == NULL)
|
if (ucode->fw == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue