On 2/26/26 16:49, Tvrtko Ursulin wrote:
> LKP reports two suspicious NULL pointer checks, triggered by
> 4ca06f6fb45d ("drm/amdgpu/userq: Use drm_gem_objects_lookup in 
> amdgpu_userq_signal_ioctl")
> but these checks were redundant even before. Remove them.
> 
> Signed-off-by: Tvrtko Ursulin <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Closes: https://lore.kernel.org/r/[email protected]/
> Cc: Alex Deucher <[email protected]>
> Cc: Christian König <[email protected]>
> Cc: Sunil Khatri <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index ba128b2a2d49..0f941021fcf4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -548,7 +548,7 @@ int amdgpu_userq_signal_ioctl(struct drm_device *dev, 
> void *data,
>       }
>  
>       for (i = 0; i < num_read_bo_handles; i++) {
> -             if (!gobj_read || !gobj_read[i]->resv)
> +             if (!gobj_read[i]->resv)
>                       continue;

The test for resv not NULL is also completely superfluous here.

We would have crashed much earlier with a NULL pointer dereference if the GEM 
object would be mangled like that.

Regards,
Christian.

>  
>               dma_resv_add_fence(gobj_read[i]->resv, fence,
> @@ -556,7 +556,7 @@ int amdgpu_userq_signal_ioctl(struct drm_device *dev, 
> void *data,
>       }
>  
>       for (i = 0; i < num_write_bo_handles; i++) {
> -             if (!gobj_write || !gobj_write[i]->resv)
> +             if (!gobj_write[i]->resv)
>                       continue;
>  
>               dma_resv_add_fence(gobj_write[i]->resv, fence,

Reply via email to