Skip to contentSkip to conversation

drm/amdgpu: add missed return value set for error case

PATCH In review Guchun Chen 2 participants 2 messages Dec 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add missed return value set for error case

Return value should be set when going to error handle tag for error case, this can avoid potential invalid array access by upper caller.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
index 3f4ba408aee0..511b137d9d5a 100644
@@ -1313,6 +1313,7 @@ static int amdgpu_ras_badpages_read(struct amdgpu_device *adev,
 	data = con->eh_data;
 	if (!data || data->count == 0) {
 		*bps = NULL;
+		ret = -EINVAL;
 		goto out;
 	}
 
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Monday, December 23, 2019 12:42
To: Zhou1, Tao <[email protected]>; Zhang, Hawking <[email protected]>; Li, Dennis <[email protected]>; [email protected]
Cc: Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdgpu: add missed return value set for error case

Return value should be set when going to error handle tag for error case, this can avoid potential invalid array access by upper caller.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
index 3f4ba408aee0..511b137d9d5a 100644
@@ -1313,6 +1313,7 @@ static int amdgpu_ras_badpages_read(struct amdgpu_device *adev,
 	data = con->eh_data;
 	if (!data || data->count == 0) {
 		*bps = NULL;
+		ret = -EINVAL;
 		goto out;
 	}
 

--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx