All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: net/netlink/af_netlink.c:817:52: sparse: sparse: self-comparison always evaluates to false
Date: Thu, 16 Nov 2023 07:00:48 +0800	[thread overview]
Message-ID: <202311160602.lrAPNfdx-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence static check warning: net/netlink/af_netlink.c:817:52: sparse: sparse: self-comparison always evaluates to false"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Eric Dumazet <edumazet@google.com>
CC: Kuniyuki Iwashima <kuniyu@amazon.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
commit: 0cafd77dcd032d1687efaba5598cf07bce85997f net: add a refcount tracker for kernel sockets
date:   1 year, 1 month ago
:::::: branch date: 18 hours ago
:::::: commit date: 1 year, 1 month ago
config: sparc-randconfig-r021-20230427 (https://download.01.org/0day-ci/archive/20231116/202311160602.lrAPNfdx-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231116/202311160602.lrAPNfdx-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/r/202311160602.lrAPNfdx-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   net/netlink/af_netlink.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/umh.h, include/linux/kmod.h, ...):
   include/linux/page-flags.h:248:46: sparse: sparse: self-comparison always evaluates to false
>> net/netlink/af_netlink.c:817:52: sparse: sparse: self-comparison always evaluates to false
   net/netlink/af_netlink.c:2618:13: sparse: sparse: context imbalance in 'netlink_walk_start' - wrong count at exit
   net/netlink/af_netlink.c:2624:13: sparse: sparse: context imbalance in 'netlink_walk_stop' - unexpected unlock
   net/netlink/af_netlink.c:2674:9: sparse: sparse: context imbalance in 'netlink_seq_start' - wrong count at exit

vim +817 net/netlink/af_netlink.c

21e4902aea80ef Thomas Graf        2015-01-02  747  
^1da177e4c3f41 Linus Torvalds     2005-04-16  748  static int netlink_release(struct socket *sock)
^1da177e4c3f41 Linus Torvalds     2005-04-16  749  {
^1da177e4c3f41 Linus Torvalds     2005-04-16  750  	struct sock *sk = sock->sk;
^1da177e4c3f41 Linus Torvalds     2005-04-16  751  	struct netlink_sock *nlk;
^1da177e4c3f41 Linus Torvalds     2005-04-16  752  
^1da177e4c3f41 Linus Torvalds     2005-04-16  753  	if (!sk)
^1da177e4c3f41 Linus Torvalds     2005-04-16  754  		return 0;
^1da177e4c3f41 Linus Torvalds     2005-04-16  755  
^1da177e4c3f41 Linus Torvalds     2005-04-16  756  	netlink_remove(sk);
ac57b3a9ce2807 Denis Lunev        2007-04-18  757  	sock_orphan(sk);
^1da177e4c3f41 Linus Torvalds     2005-04-16  758  	nlk = nlk_sk(sk);
^1da177e4c3f41 Linus Torvalds     2005-04-16  759  
3f660d66dfbc13 Herbert Xu         2007-05-03  760  	/*
3f660d66dfbc13 Herbert Xu         2007-05-03  761  	 * OK. Socket is unlinked, any packets that arrive now
3f660d66dfbc13 Herbert Xu         2007-05-03  762  	 * will be purged.
3f660d66dfbc13 Herbert Xu         2007-05-03  763  	 */
^1da177e4c3f41 Linus Torvalds     2005-04-16  764  
ee1c244219fd65 Johannes Berg      2015-01-16  765  	/* must not acquire netlink_table_lock in any way again before unbind
ee1c244219fd65 Johannes Berg      2015-01-16  766  	 * and notifying genetlink is done as otherwise it might deadlock
ee1c244219fd65 Johannes Berg      2015-01-16  767  	 */
ee1c244219fd65 Johannes Berg      2015-01-16  768  	if (nlk->netlink_unbind) {
ee1c244219fd65 Johannes Berg      2015-01-16  769  		int i;
ee1c244219fd65 Johannes Berg      2015-01-16  770  
ee1c244219fd65 Johannes Berg      2015-01-16  771  		for (i = 0; i < nlk->ngroups; i++)
ee1c244219fd65 Johannes Berg      2015-01-16  772  			if (test_bit(i, nlk->groups))
ee1c244219fd65 Johannes Berg      2015-01-16  773  				nlk->netlink_unbind(sock_net(sk), i + 1);
ee1c244219fd65 Johannes Berg      2015-01-16  774  	}
ee1c244219fd65 Johannes Berg      2015-01-16  775  	if (sk->sk_protocol == NETLINK_GENERIC &&
ee1c244219fd65 Johannes Berg      2015-01-16  776  	    atomic_dec_return(&genl_sk_destructing_cnt) == 0)
ee1c244219fd65 Johannes Berg      2015-01-16  777  		wake_up(&genl_sk_destructing_waitq);
ee1c244219fd65 Johannes Berg      2015-01-16  778  
^1da177e4c3f41 Linus Torvalds     2005-04-16  779  	sock->sk = NULL;
^1da177e4c3f41 Linus Torvalds     2005-04-16  780  	wake_up_interruptible_all(&nlk->wait);
^1da177e4c3f41 Linus Torvalds     2005-04-16  781  
^1da177e4c3f41 Linus Torvalds     2005-04-16  782  	skb_queue_purge(&sk->sk_write_queue);
^1da177e4c3f41 Linus Torvalds     2005-04-16  783  
e27260203912b4 Dmitry Ivanov      2016-04-07  784  	if (nlk->portid && nlk->bound) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  785  		struct netlink_notify n = {
3b1e0a655f8eba YOSHIFUJI Hideaki  2008-03-26  786  						.net = sock_net(sk),
^1da177e4c3f41 Linus Torvalds     2005-04-16  787  						.protocol = sk->sk_protocol,
15e473046cb6e5 Eric W. Biederman  2012-09-07  788  						.portid = nlk->portid,
^1da177e4c3f41 Linus Torvalds     2005-04-16  789  					  };
efa172f4283647 WANG Cong          2016-12-09  790  		blocking_notifier_call_chain(&netlink_chain,
e041c683412d5b Alan Stern         2006-03-27  791  				NETLINK_URELEASE, &n);
^1da177e4c3f41 Linus Torvalds     2005-04-16  792  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  793  
77247bbb309424 Patrick McHardy    2005-08-14  794  	module_put(nlk->module);
4fdb3bb723db46 Harald Welte       2005-08-09  795  
aed815601f3f95 Denis V. Lunev     2007-10-10  796  	if (netlink_is_kernel(sk)) {
b10dcb3b94010e Johannes Berg      2014-12-22  797  		netlink_table_grab();
869e58f87094b1 Denis V. Lunev     2008-01-18  798  		BUG_ON(nl_table[sk->sk_protocol].registered == 0);
869e58f87094b1 Denis V. Lunev     2008-01-18  799  		if (--nl_table[sk->sk_protocol].registered == 0) {
6d772ac5578f71 Eric Dumazet       2012-10-18  800  			struct listeners *old;
6d772ac5578f71 Eric Dumazet       2012-10-18  801  
6d772ac5578f71 Eric Dumazet       2012-10-18  802  			old = nl_deref_protected(nl_table[sk->sk_protocol].listeners);
6d772ac5578f71 Eric Dumazet       2012-10-18  803  			RCU_INIT_POINTER(nl_table[sk->sk_protocol].listeners, NULL);
6d772ac5578f71 Eric Dumazet       2012-10-18  804  			kfree_rcu(old, rcu);
77247bbb309424 Patrick McHardy    2005-08-14  805  			nl_table[sk->sk_protocol].module = NULL;
9785e10aedfa0f Pablo Neira Ayuso  2012-09-08  806  			nl_table[sk->sk_protocol].bind = NULL;
4f520900522fd5 Richard Guy Briggs 2014-04-22  807  			nl_table[sk->sk_protocol].unbind = NULL;
9785e10aedfa0f Pablo Neira Ayuso  2012-09-08  808  			nl_table[sk->sk_protocol].flags = 0;
ab33a1711cf60b Patrick McHardy    2005-08-14  809  			nl_table[sk->sk_protocol].registered = 0;
869e58f87094b1 Denis V. Lunev     2008-01-18  810  		}
4fdb3bb723db46 Harald Welte       2005-08-09  811  		netlink_table_ungrab();
b10dcb3b94010e Johannes Berg      2014-12-22  812  	}
4fdb3bb723db46 Harald Welte       2005-08-09  813  
c1fd3b9455a977 Eric Dumazet       2008-11-23  814  	sock_prot_inuse_add(sock_net(sk), &netlink_proto, -1);
0cafd77dcd032d Eric Dumazet       2022-10-20  815  
0cafd77dcd032d Eric Dumazet       2022-10-20  816  	/* Because struct net might disappear soon, do not keep a pointer. */
0cafd77dcd032d Eric Dumazet       2022-10-20 @817  	if (!sk->sk_net_refcnt && sock_net(sk) != &init_net) {
0cafd77dcd032d Eric Dumazet       2022-10-20  818  		__netns_tracker_free(sock_net(sk), &sk->ns_tracker, false);
0cafd77dcd032d Eric Dumazet       2022-10-20  819  		/* Because of deferred_put_nlk_sk and use of work queue,
0cafd77dcd032d Eric Dumazet       2022-10-20  820  		 * it is possible  netns will be freed before this socket.
0cafd77dcd032d Eric Dumazet       2022-10-20  821  		 */
0cafd77dcd032d Eric Dumazet       2022-10-20  822  		sock_net_set(sk, &init_net);
0cafd77dcd032d Eric Dumazet       2022-10-20  823  		__netns_tracker_alloc(&init_net, &sk->ns_tracker,
0cafd77dcd032d Eric Dumazet       2022-10-20  824  				      false, GFP_KERNEL);
0cafd77dcd032d Eric Dumazet       2022-10-20  825  	}
21e4902aea80ef Thomas Graf        2015-01-02  826  	call_rcu(&nlk->rcu, deferred_put_nlk_sk);
^1da177e4c3f41 Linus Torvalds     2005-04-16  827  	return 0;
^1da177e4c3f41 Linus Torvalds     2005-04-16  828  }
^1da177e4c3f41 Linus Torvalds     2005-04-16  829  

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

                 reply	other threads:[~2023-11-15 23:01 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=202311160602.lrAPNfdx-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.