All of lore.kernel.org
 help / color / mirror / Atom feed
* [netfilter-nf-next:for-netdev-nf-next-26-06-14 3/11] net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
@ 2026-06-14 22:26 kernel test robot
  2026-06-15  0:38 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-06-14 22:26 UTC (permalink / raw)
  To: Florian Westphal; +Cc: oe-kbuild-all, Pablo Neira Ayuso

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git for-netdev-nf-next-26-06-14
head:   2354e975932dabb06fad239f07a3b68fd1809737
commit: 64d7d5abe2160bba369b4a8f06bdf5630573bab0 [3/11] netfilter: nf_conncount: callers must hold rcu read lock
config: x86_64-randconfig-123-20260614 (https://download.01.org/0day-ci/archive/20260615/202606150616.cpmJToWO-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260615/202606150616.cpmJToWO-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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606150616.cpmJToWO-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_conncount.c:502:18: sparse:    struct rb_node [noderef] __rcu *
   net/netfilter/nf_conncount.c:502:18: sparse:    struct rb_node *
   net/netfilter/nf_conncount.c:510:34: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_conncount.c:510:34: sparse:    struct rb_node [noderef] __rcu *
   net/netfilter/nf_conncount.c:510:34: sparse:    struct rb_node *
   net/netfilter/nf_conncount.c:512:34: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/netfilter/nf_conncount.c:512:34: sparse:    struct rb_node [noderef] __rcu *
   net/netfilter/nf_conncount.c:512:34: sparse:    struct rb_node *
   net/netfilter/nf_conncount.c: note: in included file (through include/linux/mm_types.h, include/linux/uio.h, include/linux/socket.h, include/uapi/linux/in.h, ...):
   include/linux/rbtree.h:107:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rbtree.h:107:9: sparse:    struct rb_node [noderef] __rcu *
   include/linux/rbtree.h:107:9: sparse:    struct rb_node *

vim +502 net/netfilter/nf_conncount.c

   486	
   487	static unsigned int
   488	count_tree(struct net *net,
   489		   const struct sk_buff *skb,
   490		   u16 l3num,
   491		   struct nf_conncount_data *data,
   492		   const u32 *key)
   493	{
   494		struct rb_root *root;
   495		struct rb_node *parent;
   496		struct nf_conncount_rb *rbconn;
   497		unsigned int hash;
   498	
   499		hash = jhash2(key, data->keylen, data->initval) % CONNCOUNT_SLOTS;
   500		root = &data->root[hash];
   501	
 > 502		parent = rcu_dereference(root->rb_node);
   503		while (parent) {
   504			int diff;
   505	
   506			rbconn = rb_entry(parent, struct nf_conncount_rb, node);
   507	
   508			diff = key_diff(key, rbconn->key, data->keylen);
   509			if (diff < 0) {
   510				parent = rcu_dereference(parent->rb_left);
   511			} else if (diff > 0) {
   512				parent = rcu_dereference(parent->rb_right);
   513			} else {
   514				int ret;
   515	
   516				if (!skb) {
   517					nf_conncount_gc_list(net, &rbconn->list);
   518					return rbconn->list.count;
   519				}
   520	
   521				spin_lock_bh(&rbconn->list.list_lock);
   522				/* Node might be about to be free'd.
   523				 * We need to defer to insert_tree() in this case.
   524				 */
   525				if (rbconn->list.count == 0) {
   526					spin_unlock_bh(&rbconn->list.list_lock);
   527					break;
   528				}
   529	
   530				/* same source network -> be counted! */
   531				ret = __nf_conncount_add(net, skb, l3num, &rbconn->list);
   532				spin_unlock_bh(&rbconn->list.list_lock);
   533				if (ret && ret != -EEXIST) {
   534					return 0; /* hotdrop */
   535				} else {
   536					/* -EEXIST means add was skipped, update the list */
   537					if (ret == -EEXIST)
   538						nf_conncount_gc_list(net, &rbconn->list);
   539					return rbconn->list.count;
   540				}
   541			}
   542		}
   543	
   544		if (!skb)
   545			return 0;
   546	
   547		return insert_tree(net, skb, l3num, data, root, hash, key);
   548	}
   549	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [netfilter-nf-next:for-netdev-nf-next-26-06-14 3/11] net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
  2026-06-14 22:26 [netfilter-nf-next:for-netdev-nf-next-26-06-14 3/11] net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces): kernel test robot
@ 2026-06-15  0:38 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2026-06-15  0:38 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-kbuild-all, Pablo Neira Ayuso, netdev, netfilter-devel

kernel test robot <lkp@intel.com> wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git for-netdev-nf-next-26-06-14
> head:   2354e975932dabb06fad239f07a3b68fd1809737
> commit: 64d7d5abe2160bba369b4a8f06bdf5630573bab0 [3/11] netfilter: nf_conncount: callers must hold rcu read lock
> config: x86_64-randconfig-123-20260614 (https://download.01.org/0day-ci/archive/20260615/202606150616.cpmJToWO-lkp@intel.com/config)
> compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260615/202606150616.cpmJToWO-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
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202606150616.cpmJToWO-lkp@intel.com/
> 
> sparse warnings: (new ones prefixed by >>)
> >> net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
>    net/netfilter/nf_conncount.c:502:18: sparse:    struct rb_node [noderef] __rcu *
>    net/netfilter/nf_conncount.c:502:18: sparse:    struct rb_node *
>    net/netfilter/nf_conncount.c:510:34: sparse: sparse: incompatible types in comparison expression (different address spaces):
>    net/netfilter/nf_conncount.c:510:34: sparse:    struct rb_node [noderef] __rcu *
>    net/netfilter/nf_conncount.c:510:34: sparse:    struct rb_node *
>    net/netfilter/nf_conncount.c:512:34: sparse: sparse: incompatible types in comparison expression (different address spaces):
>    net/netfilter/nf_conncount.c:512:34: sparse:    struct rb_node [noderef] __rcu *
>    net/netfilter/nf_conncount.c:512:34: sparse:    struct rb_node *

Thanks but I have no intent to fix this.

Between rcu_dereference_raw() not giving sparse warnings but also not
providing any hints when callers don't hold rcu read lock and plain
rcu_dereference() that does give runtime coverage but results in above
sparse output I will pick the latter and just ignore these warnings.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-15  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-14 22:26 [netfilter-nf-next:for-netdev-nf-next-26-06-14 3/11] net/netfilter/nf_conncount.c:502:18: sparse: sparse: incompatible types in comparison expression (different address spaces): kernel test robot
2026-06-15  0:38 ` Florian Westphal

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.