lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111222327.Ulk3z49S-lkp@intel.com>
Date:   Mon, 22 Nov 2021 23:41:40 +0800
From:   kernel test robot <lkp@...el.com>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: net/netlabel/netlabel_domainhash.c:495:21: warning: variable
 'old_list6' set but not used

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   136057256686de39cc3a07c2e39ef6bc43003ff6
commit: 010b430d5df556d5d232e3751ac691ba9e88c041 mptcp: MPTCP_IPV6 should depend on IPV6 instead of selecting it
date:   1 year, 1 month ago
config: x86_64-randconfig-a004-20211122 (attached as .config)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=010b430d5df556d5d232e3751ac691ba9e88c041
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 010b430d5df556d5d232e3751ac691ba9e88c041
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> net/netlabel/netlabel_domainhash.c:495:21: warning: variable 'old_list6' set but not used [-Wunused-but-set-variable]
                   struct list_head *old_list6;
                                     ^
   1 warning generated.


vim +/old_list6 +495 net/netlabel/netlabel_domainhash.c

63c41688743760 Paul Moore   2008-10-10  416  
6b21e1b77d1a3d Paul Moore   2013-05-17  417  	ret_val = netlbl_domhsh_validate(entry);
6b21e1b77d1a3d Paul Moore   2013-05-17  418  	if (ret_val != 0)
6b21e1b77d1a3d Paul Moore   2013-05-17  419  		return ret_val;
6b21e1b77d1a3d Paul Moore   2013-05-17  420  
b914f3a2a35812 Paul Moore   2010-04-01  421  	/* XXX - we can remove this RCU read lock as the spinlock protects the
b914f3a2a35812 Paul Moore   2010-04-01  422  	 *       entire function, but before we do we need to fixup the
b914f3a2a35812 Paul Moore   2010-04-01  423  	 *       netlbl_af[4,6]list RCU functions to do "the right thing" with
b914f3a2a35812 Paul Moore   2010-04-01  424  	 *       respect to rcu_dereference() when only a spinlock is held. */
63c41688743760 Paul Moore   2008-10-10  425  	rcu_read_lock();
63c41688743760 Paul Moore   2008-10-10  426  	spin_lock(&netlbl_domhsh_lock);
63c41688743760 Paul Moore   2008-10-10  427  	if (entry->domain != NULL)
8f18e675c3335b Huw Davies   2016-06-27  428  		entry_old = netlbl_domhsh_search(entry->domain, entry->family);
63c41688743760 Paul Moore   2008-10-10  429  	else
8f18e675c3335b Huw Davies   2016-06-27  430  		entry_old = netlbl_domhsh_search_def(entry->domain,
8f18e675c3335b Huw Davies   2016-06-27  431  						     entry->family);
63c41688743760 Paul Moore   2008-10-10  432  	if (entry_old == NULL) {
d15c345fe3b8df Paul Moore   2006-08-03  433  		entry->valid = 1;
d15c345fe3b8df Paul Moore   2006-08-03  434  
d15c345fe3b8df Paul Moore   2006-08-03  435  		if (entry->domain != NULL) {
63c41688743760 Paul Moore   2008-10-10  436  			u32 bkt = netlbl_domhsh_hash(entry->domain);
d15c345fe3b8df Paul Moore   2006-08-03  437  			list_add_tail_rcu(&entry->list,
3482fd9099e8aa Paul Moore   2007-08-07  438  				    &rcu_dereference(netlbl_domhsh)->tbl[bkt]);
4be2700fb7b95f Paul Moore   2007-10-26  439  		} else {
d15c345fe3b8df Paul Moore   2006-08-03  440  			INIT_LIST_HEAD(&entry->list);
8f18e675c3335b Huw Davies   2016-06-27  441  			switch (entry->family) {
8f18e675c3335b Huw Davies   2016-06-27  442  			case AF_INET:
8f18e675c3335b Huw Davies   2016-06-27  443  				rcu_assign_pointer(netlbl_domhsh_def_ipv4,
8f18e675c3335b Huw Davies   2016-06-27  444  						   entry);
8f18e675c3335b Huw Davies   2016-06-27  445  				break;
8f18e675c3335b Huw Davies   2016-06-27  446  			case AF_INET6:
8f18e675c3335b Huw Davies   2016-06-27  447  				rcu_assign_pointer(netlbl_domhsh_def_ipv6,
8f18e675c3335b Huw Davies   2016-06-27  448  						   entry);
8f18e675c3335b Huw Davies   2016-06-27  449  				break;
8f18e675c3335b Huw Davies   2016-06-27  450  			case AF_UNSPEC:
8f18e675c3335b Huw Davies   2016-06-27  451  				if (entry->def.type !=
8f18e675c3335b Huw Davies   2016-06-27  452  				    NETLBL_NLTYPE_UNLABELED) {
8f18e675c3335b Huw Davies   2016-06-27  453  					ret_val = -EINVAL;
8f18e675c3335b Huw Davies   2016-06-27  454  					goto add_return;
8f18e675c3335b Huw Davies   2016-06-27  455  				}
8f18e675c3335b Huw Davies   2016-06-27  456  				entry_b = kzalloc(sizeof(*entry_b), GFP_ATOMIC);
8f18e675c3335b Huw Davies   2016-06-27  457  				if (entry_b == NULL) {
8f18e675c3335b Huw Davies   2016-06-27  458  					ret_val = -ENOMEM;
8f18e675c3335b Huw Davies   2016-06-27  459  					goto add_return;
8f18e675c3335b Huw Davies   2016-06-27  460  				}
8f18e675c3335b Huw Davies   2016-06-27  461  				entry_b->family = AF_INET6;
8f18e675c3335b Huw Davies   2016-06-27  462  				entry_b->def.type = NETLBL_NLTYPE_UNLABELED;
8f18e675c3335b Huw Davies   2016-06-27  463  				entry_b->valid = 1;
8f18e675c3335b Huw Davies   2016-06-27  464  				entry->family = AF_INET;
8f18e675c3335b Huw Davies   2016-06-27  465  				rcu_assign_pointer(netlbl_domhsh_def_ipv4,
8f18e675c3335b Huw Davies   2016-06-27  466  						   entry);
8f18e675c3335b Huw Davies   2016-06-27  467  				rcu_assign_pointer(netlbl_domhsh_def_ipv6,
8f18e675c3335b Huw Davies   2016-06-27  468  						   entry_b);
8f18e675c3335b Huw Davies   2016-06-27  469  				break;
8f18e675c3335b Huw Davies   2016-06-27  470  			default:
8f18e675c3335b Huw Davies   2016-06-27  471  				/* Already checked in
8f18e675c3335b Huw Davies   2016-06-27  472  				 * netlbl_domhsh_validate(). */
8f18e675c3335b Huw Davies   2016-06-27  473  				ret_val = -EINVAL;
8f18e675c3335b Huw Davies   2016-06-27  474  				goto add_return;
8f18e675c3335b Huw Davies   2016-06-27  475  			}
63c41688743760 Paul Moore   2008-10-10  476  		}
63c41688743760 Paul Moore   2008-10-10  477  
6a8b7f0c85f1f4 Paul Moore   2013-08-02  478  		if (entry->def.type == NETLBL_NLTYPE_ADDRSELECT) {
63c41688743760 Paul Moore   2008-10-10  479  			netlbl_af4list_foreach_rcu(iter4,
6a8b7f0c85f1f4 Paul Moore   2013-08-02  480  						   &entry->def.addrsel->list4)
63c41688743760 Paul Moore   2008-10-10  481  				netlbl_domhsh_audit_add(entry, iter4, NULL,
63c41688743760 Paul Moore   2008-10-10  482  							ret_val, audit_info);
dfd56b8b38fff3 Eric Dumazet 2011-12-10  483  #if IS_ENABLED(CONFIG_IPV6)
63c41688743760 Paul Moore   2008-10-10  484  			netlbl_af6list_foreach_rcu(iter6,
6a8b7f0c85f1f4 Paul Moore   2013-08-02  485  						   &entry->def.addrsel->list6)
63c41688743760 Paul Moore   2008-10-10  486  				netlbl_domhsh_audit_add(entry, NULL, iter6,
63c41688743760 Paul Moore   2008-10-10  487  							ret_val, audit_info);
63c41688743760 Paul Moore   2008-10-10  488  #endif /* IPv6 */
63c41688743760 Paul Moore   2008-10-10  489  		} else
63c41688743760 Paul Moore   2008-10-10  490  			netlbl_domhsh_audit_add(entry, NULL, NULL,
63c41688743760 Paul Moore   2008-10-10  491  						ret_val, audit_info);
6a8b7f0c85f1f4 Paul Moore   2013-08-02  492  	} else if (entry_old->def.type == NETLBL_NLTYPE_ADDRSELECT &&
6a8b7f0c85f1f4 Paul Moore   2013-08-02  493  		   entry->def.type == NETLBL_NLTYPE_ADDRSELECT) {
63c41688743760 Paul Moore   2008-10-10  494  		struct list_head *old_list4;
63c41688743760 Paul Moore   2008-10-10 @495  		struct list_head *old_list6;
63c41688743760 Paul Moore   2008-10-10  496  
6a8b7f0c85f1f4 Paul Moore   2013-08-02  497  		old_list4 = &entry_old->def.addrsel->list4;
6a8b7f0c85f1f4 Paul Moore   2013-08-02  498  		old_list6 = &entry_old->def.addrsel->list6;
63c41688743760 Paul Moore   2008-10-10  499  
63c41688743760 Paul Moore   2008-10-10  500  		/* we only allow the addition of address selectors if all of
63c41688743760 Paul Moore   2008-10-10  501  		 * the selectors do not exist in the existing domain map */
6a8b7f0c85f1f4 Paul Moore   2013-08-02  502  		netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4)
63c41688743760 Paul Moore   2008-10-10  503  			if (netlbl_af4list_search_exact(iter4->addr,
63c41688743760 Paul Moore   2008-10-10  504  							iter4->mask,
63c41688743760 Paul Moore   2008-10-10  505  							old_list4)) {
d15c345fe3b8df Paul Moore   2006-08-03  506  				ret_val = -EEXIST;
63c41688743760 Paul Moore   2008-10-10  507  				goto add_return;
4be2700fb7b95f Paul Moore   2007-10-26  508  			}
dfd56b8b38fff3 Eric Dumazet 2011-12-10  509  #if IS_ENABLED(CONFIG_IPV6)
6a8b7f0c85f1f4 Paul Moore   2013-08-02  510  		netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6)
63c41688743760 Paul Moore   2008-10-10  511  			if (netlbl_af6list_search_exact(&iter6->addr,
63c41688743760 Paul Moore   2008-10-10  512  							&iter6->mask,
63c41688743760 Paul Moore   2008-10-10  513  							old_list6)) {
63c41688743760 Paul Moore   2008-10-10  514  				ret_val = -EEXIST;
63c41688743760 Paul Moore   2008-10-10  515  				goto add_return;
32f50cdee66633 Paul Moore   2006-09-28  516  			}
63c41688743760 Paul Moore   2008-10-10  517  #endif /* IPv6 */
63c41688743760 Paul Moore   2008-10-10  518  
63c41688743760 Paul Moore   2008-10-10  519  		netlbl_af4list_foreach_safe(iter4, tmp4,
6a8b7f0c85f1f4 Paul Moore   2013-08-02  520  					    &entry->def.addrsel->list4) {
63c41688743760 Paul Moore   2008-10-10  521  			netlbl_af4list_remove_entry(iter4);
63c41688743760 Paul Moore   2008-10-10  522  			iter4->valid = 1;
63c41688743760 Paul Moore   2008-10-10  523  			ret_val = netlbl_af4list_add(iter4, old_list4);
63c41688743760 Paul Moore   2008-10-10  524  			netlbl_domhsh_audit_add(entry_old, iter4, NULL,
63c41688743760 Paul Moore   2008-10-10  525  						ret_val, audit_info);
63c41688743760 Paul Moore   2008-10-10  526  			if (ret_val != 0)
63c41688743760 Paul Moore   2008-10-10  527  				goto add_return;
de64688ffb952a Paul Moore   2006-11-17  528  		}
dfd56b8b38fff3 Eric Dumazet 2011-12-10  529  #if IS_ENABLED(CONFIG_IPV6)
63c41688743760 Paul Moore   2008-10-10  530  		netlbl_af6list_foreach_safe(iter6, tmp6,
6a8b7f0c85f1f4 Paul Moore   2013-08-02  531  					    &entry->def.addrsel->list6) {
63c41688743760 Paul Moore   2008-10-10  532  			netlbl_af6list_remove_entry(iter6);
63c41688743760 Paul Moore   2008-10-10  533  			iter6->valid = 1;
63c41688743760 Paul Moore   2008-10-10  534  			ret_val = netlbl_af6list_add(iter6, old_list6);
63c41688743760 Paul Moore   2008-10-10  535  			netlbl_domhsh_audit_add(entry_old, NULL, iter6,
63c41688743760 Paul Moore   2008-10-10  536  						ret_val, audit_info);
63c41688743760 Paul Moore   2008-10-10  537  			if (ret_val != 0)
63c41688743760 Paul Moore   2008-10-10  538  				goto add_return;
63c41688743760 Paul Moore   2008-10-10  539  		}
63c41688743760 Paul Moore   2008-10-10  540  #endif /* IPv6 */
d3b990b7f327e2 Paul Moore   2020-08-21  541  		/* cleanup the new entry since we've moved everything over */
d3b990b7f327e2 Paul Moore   2020-08-21  542  		netlbl_domhsh_free_entry(&entry->rcu);
63c41688743760 Paul Moore   2008-10-10  543  	} else
63c41688743760 Paul Moore   2008-10-10  544  		ret_val = -EINVAL;
d15c345fe3b8df Paul Moore   2006-08-03  545  
63c41688743760 Paul Moore   2008-10-10  546  add_return:
63c41688743760 Paul Moore   2008-10-10  547  	spin_unlock(&netlbl_domhsh_lock);
63c41688743760 Paul Moore   2008-10-10  548  	rcu_read_unlock();
d15c345fe3b8df Paul Moore   2006-08-03  549  	return ret_val;
d15c345fe3b8df Paul Moore   2006-08-03  550  }
d15c345fe3b8df Paul Moore   2006-08-03  551  

:::::: The code at line 495 was first introduced by commit
:::::: 63c41688743760631188cf0f4ae986a6793ccb0a netlabel: Add network address selectors to the NetLabel/LSM domain mapping

:::::: TO: Paul Moore <paul.moore@...com>
:::::: CC: Paul Moore <paul.moore@...com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (33690 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ