From: kernel test robot <lkp@intel.com>
To: Wei Wang <weibunny@fb.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
Daniel Zahka <daniel.zahka@gmail.com>
Subject: net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space '__rcu' of expression
Date: Tue, 23 Jun 2026 21:13:42 +0800 [thread overview]
Message-ID: <202606232140.CGI4No0a-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 502d801f0ab03e4f32f9a33d203154ce84887921
commit: 06c2dce2d0f69727144443664182052f56d1da35 psp: add new netlink cmd for dev-assoc and dev-disassoc
date: 11 days ago
config: riscv-randconfig-r111-20260623 (https://download.01.org/0day-ci/archive/20260623/202606232140.CGI4No0a-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260623/202606232140.CGI4No0a-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 06c2dce2d0f6 ("psp: add new netlink cmd for dev-assoc and dev-disassoc")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606232140.CGI4No0a-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space '__rcu' of expression
vim +/__rcu +513 net/psp/psp_nl.c
475
476 int psp_nl_dev_assoc_doit(struct sk_buff *skb, struct genl_info *info)
477 {
478 struct psp_dev *psd = info->user_ptr[0];
479 struct psp_assoc_dev *psp_assoc_dev;
480 struct net_device *assoc_dev;
481 struct sk_buff *rsp;
482 u32 assoc_ifindex;
483 struct net *net;
484 int err;
485
486 if (psd->assoc_dev_cnt >= PSP_ASSOC_DEV_MAX) {
487 NL_SET_ERR_MSG(info->extack,
488 "Maximum number of associated devices reached");
489 return -ENOSPC;
490 }
491
492 net = psp_nl_resolve_assoc_dev_ns(psd, info);
493 if (IS_ERR(net))
494 return PTR_ERR(net);
495
496 psp_assoc_dev = kzalloc_obj(*psp_assoc_dev);
497 if (!psp_assoc_dev) {
498 err = -ENOMEM;
499 goto err_put_net;
500 }
501
502 assoc_ifindex = nla_get_u32(info->attrs[PSP_A_DEV_IFINDEX]);
503 assoc_dev = netdev_get_by_index(net, assoc_ifindex,
504 &psp_assoc_dev->dev_tracker,
505 GFP_KERNEL);
506 if (!assoc_dev) {
507 NL_SET_BAD_ATTR(info->extack, info->attrs[PSP_A_DEV_IFINDEX]);
508 err = -ENODEV;
509 goto err_free_assoc;
510 }
511
512 /* Check if device is already associated with a PSP device */
> 513 if (cmpxchg(&assoc_dev->psp_dev, NULL, RCU_INITIALIZER(psd))) {
514 NL_SET_ERR_MSG(info->extack,
515 "Device already associated with a PSP device");
516 err = -EBUSY;
517 goto err_put_dev;
518 }
519
520 psp_assoc_dev->assoc_dev = assoc_dev;
521 rsp = psp_nl_reply_new(info);
522 if (!rsp) {
523 err = -ENOMEM;
524 goto err_clean_ptr;
525 }
526
527 list_add_tail(&psp_assoc_dev->dev_list, &psd->assoc_dev_list);
528 psd->assoc_dev_cnt++;
529
530 put_net(net);
531
532 psp_nl_notify_dev(psd, PSP_CMD_DEV_CHANGE_NTF);
533
534 return psp_nl_reply_send(rsp, info);
535
536 err_clean_ptr:
537 rcu_assign_pointer(assoc_dev->psp_dev, NULL);
538 err_put_dev:
539 netdev_put(assoc_dev, &psp_assoc_dev->dev_tracker);
540 err_free_assoc:
541 kfree(psp_assoc_dev);
542 err_put_net:
543 put_net(net);
544
545 return err;
546 }
547
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-06-23 13:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202606232140.CGI4No0a-lkp@intel.com \
--to=lkp@intel.com \
--cc=daniel.zahka@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--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.