Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Misuse of rcu_access_pointer() on a non-RCU annotated pointer (f->ops), 
which actively triggers a Sparse warning.
--

--- Patch [1]: [PATCH 1/2] drm/amdgpu: Fix __rcu fence pointer accesses ---
commit 5448af797b4d872eec1209aac5ec209c3c2b6b4a
Author: Alex Hung <[email protected]>

drm/amdgpu: Fix __rcu fence pointer accesses

This commit uses rcu_access_pointer() to resolve sparse warnings when
comparing fence pointers in the KFD code. It wraps f->ops and an
eviction fence pointer to address 'incompatible types in comparison
expression' warnings.

Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> index 31b8fa52b42fa..3419bad5c23a7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> @@ -92,7 +92,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct 
> dma_fence *f)
>               return NULL;
>  
>       fence = container_of(f, struct amdgpu_amdkfd_fence, base);
> -     if (f->ops == &amdkfd_fence_ops)
> +     if (rcu_access_pointer(f->ops) == &amdkfd_fence_ops)

[Severity: Low]
Is f->ops actually an __rcu-annotated pointer? 

Looking at struct dma_fence, the ops field is a standard
const struct dma_fence_ops * without the __rcu annotation.

Does wrapping a non-RCU pointer in rcu_access_pointer() trigger the exact
Sparse warning ("different address spaces") this commit aims to fix, since
the macro expects an __rcu pointer?

>               return fence;
>  
>       return NULL;

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to