On 2/27/26 10:45, 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.
> 
> While doing this we notice the obj->resv NULL checks are redundant too,
> since they have already been dereferenced in the drm_exec locking pass.
> 
> 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]>

Reviewed-by: Christian König <[email protected]>

> ---
> v2:
>  * Drop the obj->resv checks too. (Christian)
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 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..f54e0e2c0dbf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -547,21 +547,13 @@ 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)
> -                     continue;
> -
> +     for (i = 0; i < num_read_bo_handles; i++)
>               dma_resv_add_fence(gobj_read[i]->resv, fence,
>                                  DMA_RESV_USAGE_READ);
> -     }
> -
> -     for (i = 0; i < num_write_bo_handles; i++) {
> -             if (!gobj_write || !gobj_write[i]->resv)
> -                     continue;
>  
> +     for (i = 0; i < num_write_bo_handles; i++)
>               dma_resv_add_fence(gobj_write[i]->resv, fence,
>                                  DMA_RESV_USAGE_WRITE);
> -     }
>  
>       /* Add the created fence to syncobj/BO's */
>       for (i = 0; i < num_syncobj_handles; i++)

Reply via email to