Skip to contentSkip to conversation

psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev

PATCH Applied Wei Wang 5 participants 6 messages Aug 13 – Aug 17

Subsystems (3)
lore
Share & tools
lore

Wei Wang

author
#0 lore raw

PATCH 1/1 psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev

From: Wei Wang <[email protected]>

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.

---
 net/psp/psp_nl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/psp/psp_nl.c +2 -1
index 43b066353c65..f91665748dde 100644
@@ -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;
Signature · 1 line
2.53.0-Meta
maintainer
#1 lore raw
Quoted 11 lines · Wei Wang

From: Wei Wang <[email protected]>

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.

Quoted 8 lines

This was introduced by commit 06c2dce2d0f6 ("psp: add new netlink cmd for dev-assoc and dev-disassoc").

No functional change intended.

Commits targeting the net tree need a fixes tag.

#2 lore raw
Quoted 19 lines · Daniel Zahka
Quoted 2 lines
Quoted 14 lines · Wei Wang

From: Wei Wang <[email protected]>

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").

Quoted 6 lines
Quoted 5 lines

No functional change intended.

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.

maintainer
#3 lore raw
Quoted 8 lines · On Thu, 13 Aug 2026 13:37:23 -0700 Wei Wang wrote:
Quoted 4 lines
Quoted 3 lines

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.

I mentioned "no Fixes tag needed" in internal review, I should have been more clear that this implies net-next, sorry.

No need to repost - we'll route it to net-next when applying.

#4 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 2 lines
Quoted 5 lines · On Thu, 13 Aug 2026 13:37:23 -0700 Wei Wang wrote:
Quoted 4 lines
Quoted 3 lines

Commits targeting the net tree need a fixes tag.

Quoted 8 lines
Quoted 3 lines

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.

I mentioned "no Fixes tag needed" in internal review, I should have been more clear that this implies net-next, sorry.

No need to repost - we'll route it to net-next when applying.

Thanks! Noted for next time.

#5 lore raw
In reply to Wei Wang
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 13 Aug 2026 12:34:16 -0700 you wrote:

From: Wei Wang <[email protected]>

sparse reports:

net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space '__rcu' of expression

[...]

Here is the summary with links:
- [net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev

    https://git.kernel.org/netdev/net-next/c/97a1e65df7ee

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html