drm/amdgpu: add missed return value set for error case
authorGuchun Chen <guchun.chen@amd.com>
Mon, 23 Dec 2019 03:40:13 +0000 (11:40 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Dec 2019 19:59:51 +0000 (14:59 -0500)
Return value should be set when going to error handle tag
for error case, this can avoid potential invalid array
access by upper caller.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index ad593d1..96fc538 100644 (file)
@@ -1311,6 +1311,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;
        }