* [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev
@ 2026-08-13 19:34 Wei Wang
2026-08-13 19:57 ` Daniel Zahka
0 siblings, 1 reply; 3+ messages in thread
From: Wei Wang @ 2026-08-13 19:34 UTC (permalink / raw)
To: daniel.zahka, kuba, netdev, linux-kernel; +Cc: Wei Wang, kernel test robot
From: Wei Wang <weibunny@fb.com>
sparse reports:
net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space
'__rcu' of expression
cmpxchg() returns typeof(*ptr) and its internal casts strip the __rcu
annotation. Wrap it in unrcu_pointer(), the documented way to use an
__rcu pointer with xchg() and friends.
This was introduced by commit 06c2dce2d0f6 ("psp: add new netlink cmd
for dev-assoc and dev-disassoc").
No functional change intended.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202608080910.l9KvOH7O-lkp@intel.com/
Signed-off-by: Wei Wang <weibunny@fb.com>
---
net/psp/psp_nl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/psp/psp_nl.c b/net/psp/psp_nl.c
index 43b066353c65..f91665748dde 100644
--- a/net/psp/psp_nl.c
+++ b/net/psp/psp_nl.c
@@ -533,7 +533,8 @@ int psp_nl_dev_assoc_doit(struct sk_buff *skb, struct genl_info *info)
}
/* Check if device is already associated with a PSP device */
- if (cmpxchg(&assoc_dev->psp_dev, NULL, RCU_INITIALIZER(psd))) {
+ if (unrcu_pointer(cmpxchg(&assoc_dev->psp_dev, NULL,
+ RCU_INITIALIZER(psd)))) {
NL_SET_ERR_MSG(info->extack,
"Device already associated with a PSP device");
err = -EBUSY;
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev
2026-08-13 19:34 [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev Wei Wang
@ 2026-08-13 19:57 ` Daniel Zahka
2026-08-13 20:37 ` Wei Wang
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Zahka @ 2026-08-13 19:57 UTC (permalink / raw)
To: Wei Wang, kuba, netdev, linux-kernel; +Cc: Wei Wang, kernel test robot
On 8/13/26 3:34 PM, Wei Wang wrote:
> From: Wei Wang <weibunny@fb.com>
>
> sparse reports:
>
> net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space
> '__rcu' of expression
>
> cmpxchg() returns typeof(*ptr) and its internal casts strip the __rcu
> annotation. Wrap it in unrcu_pointer(), the documented way to use an
> __rcu pointer with xchg() and friends.
>
> This was introduced by commit 06c2dce2d0f6 ("psp: add new netlink cmd
> for dev-assoc and dev-disassoc").
>
> No functional change intended.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202608080910.l9KvOH7O-lkp@intel.com/
> Signed-off-by: Wei Wang <weibunny@fb.com>
Commits targeting the net tree need a fixes tag.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev
2026-08-13 19:57 ` Daniel Zahka
@ 2026-08-13 20:37 ` Wei Wang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Wang @ 2026-08-13 20:37 UTC (permalink / raw)
To: Daniel Zahka
Cc: Wei Wang, kuba, netdev, linux-kernel, Wei Wang, kernel test robot
On Thu, Aug 13, 2026 at 12:57 PM Daniel Zahka <daniel.zahka@gmail.com> wrote:
>
> >
>
>
> On 8/13/26 3:34 PM, Wei Wang wrote:
> > From: Wei Wang <weibunny@fb.com>
> >
> > sparse reports:
> >
> > net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space
> > '__rcu' of expression
> >
> > cmpxchg() returns typeof(*ptr) and its internal casts strip the __rcu
> > annotation. Wrap it in unrcu_pointer(), the documented way to use an
> > __rcu pointer with xchg() and friends.
> >
> > This was introduced by commit 06c2dce2d0f6 ("psp: add new netlink cmd
> > for dev-assoc and dev-disassoc").
> >
> > No functional change intended.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202608080910.l9KvOH7O-lkp@intel.com/
> > Signed-off-by: Wei Wang <weibunny@fb.com>
> Commits targeting the net tree need a fixes tag.
This is a sparse warning fix, my understanding is that it's not a
functional fix and therefore should not use a Fixes tag. Please let me
know if my understanding is wrong.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-13 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 19:34 [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev Wei Wang
2026-08-13 19:57 ` Daniel Zahka
2026-08-13 20:37 ` Wei Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox