[PATCH] drm/amdgpu: add missing NULL check
Alex Deucher
alexdeucher at gmail.com
Fri Oct 6 14:41:24 UTC 2023
On Fri, Oct 6, 2023 at 9:07 AM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> bo->tbo.resource can easily be NULL here.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Add a link to the bug report? With that:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index f3ee83cdf97e..d28e21baef16 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
> struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
> struct amdgpu_res_cursor cursor;
>
> - if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
> + if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
> return false;
>
> amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
> --
> 2.34.1
>
More information about the amd-gfx
mailing list