All of lore.kernel.org
 help / color / mirror / Atom feed
* net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space '__rcu' of expression
@ 2026-06-23 13:13 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-06-23 13:13 UTC (permalink / raw)
  To: Wei Wang; +Cc: oe-kbuild-all, linux-kernel, Jakub Kicinski, Daniel Zahka

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-23 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 13:13 net/psp/psp_nl.c:513:13: sparse: sparse: cast removes address space '__rcu' of expression kernel test robot

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.