From: Wei Wang <weibunny.kernel@gmail.com>
To: daniel.zahka@gmail.com, kuba@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Wei Wang <weibunny@fb.com>, kernel test robot <lkp@intel.com>
Subject: [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev
Date: Thu, 13 Aug 2026 12:34:16 -0700 [thread overview]
Message-ID: <20260813193416.1544518-1-weibunny.kernel@gmail.com> (raw)
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
next reply other threads:[~2026-08-13 19:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 19:34 Wei Wang [this message]
2026-08-13 19:57 ` [PATCH net] psp: use unrcu_pointer() for the cmpxchg() on netdev psp_dev Daniel Zahka
2026-08-13 20:37 ` Wei Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260813193416.1544518-1-weibunny.kernel@gmail.com \
--to=weibunny.kernel@gmail.com \
--cc=daniel.zahka@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=weibunny@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.