[AMD Official Use Only - General]

Reviewed-by: Tao Zhou <tao.zh...@amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-boun...@lists.freedesktop.org> On Behalf Of
> Stanley.Yang
> Sent: Thursday, September 28, 2023 11:46 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Yang, Stanley <stanley.y...@amd.com>
> Subject: [PATCH Review 1/1] drm/amdgpu: Fix potential null pointer derefernce
>
> The amdgpu_ras_get_context may return NULL if device not support ras feature,
> so add check before using.
>
> Signed-off-by: Stanley.Yang <stanley.y...@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index cca3faf4dc23..60f8a18592b7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -5391,7 +5391,8 @@ int amdgpu_device_gpu_recover(struct
> amdgpu_device *adev,
>        * Flush RAM to disk so that after reboot
>        * the user can read log and see why the system rebooted.
>        */
> -     if (need_emergency_restart && amdgpu_ras_get_context(adev)-
> >reboot) {
> +     if (need_emergency_restart && amdgpu_ras_get_context(adev) &&
> +             amdgpu_ras_get_context(adev)->reboot) {
>               DRM_WARN("Emergency reboot.");
>
>               ksys_sync_helper();
> --
> 2.25.1

Reply via email to