[PATCH] drm/amdgpu: Fix potential NULL dereference

Christian König ckoenig.leichtzumerken at gmail.com
Thu Jan 5 09:15:53 UTC 2023


Am 04.01.23 um 23:19 schrieb Luben Tuikov:
> Fix potential NULL dereference, in the case when "man", the resource manager
> might be NULL, when/if we print debug information.
>
> Cc: Alex Deucher <Alexander.Deucher at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: AMD Graphics <amd-gfx at lists.freedesktop.org>
> Cc: Dan Carpenter <error27 at gmail.com>
> Cc: kernel test robot <lkp at intel.com>
> Fixes: 7554886daa31ea ("drm/amdgpu: Fix size validation for non-exclusive domains (v4)")
> Signed-off-by: Luben Tuikov <luben.tuikov at amd.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index af716afad9a59a..d1c90015651ba5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -470,8 +470,9 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
>   	return true;
>   
>   fail:
> -	DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
> -		  man->size);
> +	if (man)
> +		DRM_DEBUG("BO size %lu > total memory in domain: %llu\n", size,
> +			  man->size);
>   	return false;
>   }
>   
>
> base-commit: b45d1c2754f5080acf2096ffcb17bcfeee7f5c2f



More information about the amd-gfx mailing list