[PATCH 1/2] drm/amdgpu: avoid null pointer dereference
Zhou1, Tao
Tao.Zhou1 at amd.com
Wed Sep 18 06:00:03 UTC 2019
"control = &con->eeprom_control" is suggested, apart from this, the series is:
Reviewed-by: Tao Zhou <tao.zhou1 at amd.com>
> -----Original Message-----
> From: Chen, Guchun <Guchun.Chen at amd.com>
> Sent: 2019年9月18日 11:38
> To: amd-gfx at lists.freedesktop.org; Zhang, Hawking
> <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>;
> Grodzovsky, Andrey <Andrey.Grodzovsky at amd.com>
> Cc: Chen, Guchun <Guchun.Chen at amd.com>
> Subject: [PATCH 1/2] drm/amdgpu: avoid null pointer dereference
>
> null ptr should be checked first to avoid null ptr access
>
> Change-Id: I85c0a096eef77cad3a34265c995b1845451e04d0
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 ++--
> 1 file 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 090daf595469..c3090f0eb604 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1334,13 +1334,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 = &adev->psp.ras.ras->eeprom_control;
> data = con->eh_data;
> save_count = data->count - control->num_recs;
> /* only new entries are saved */
> --
> 2.17.1
More information about the amd-gfx
mailing list