[PATCH] drm/amdgpu: don't try to unreserve NULL pointer

Zhu, Rex Rex.Zhu at amd.com
Tue Sep 18 06:16:18 UTC 2018



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Christian König
> Sent: Tuesday, September 18, 2018 2:07 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu: don't try to unreserve NULL pointer
> 
> Don't try to unreserve a BO we doesn't allocated.
> 
> Fixes: 07012fdd497e drm/amdgpu: don't allocate zero sized kernel BOs
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 84d82d5382f9..c1387efc0c91 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -348,7 +348,8 @@ int amdgpu_bo_create_kernel(struct amdgpu_device
> *adev,
>  	if (r)
>  		return r;
> 
> -	amdgpu_bo_unreserve(*bo_ptr);
> +	if (*bo_ptr)
> +		amdgpu_bo_unreserve(*bo_ptr);
> 
>  	return 0;
>  }
It is weird. 
If we return true for allocate bo with size  0.
Does that mean we need to check all the bo_ptr before we use them.

Best Regards
Rex
 
> --
> 2.14.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list