summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
diff options
context:
space:
mode:
authorGuchun Chen <guchun.chen@amd.com>2019-09-17 17:49:29 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-10-03 09:10:59 -0500
commit8a3e801f1924c07781e93f043a74cfa244451787 (patch)
treeffa20dffa9313914483d1f6f8f018c51b972caae /drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
parentf256ba473ea82f16be657752d7d5cf7e75164085 (diff)
drm/amdgpu: avoid null pointer dereference
null ptr should be checked first to avoid null ptr access Signed-off-by: Guchun Chen <guchun.chen@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 24fecaae415c..83b681a16e56 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1336,13 +1336,13 @@ static int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev)
{
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
struct ras_err_handler_data *data;
- struct amdgpu_ras_eeprom_control *control =
- &adev->psp.ras.ras->eeprom_control;
+ struct amdgpu_ras_eeprom_control *control;
int save_count;
if (!con || !con->eh_data)
return 0;
+ control = &con->eeprom_control;
data = con->eh_data;
save_count = data->count - control->num_recs;
/* only new entries are saved */