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: <202112151203.qazbGUpx-lkp@intel.com>
Date:   Wed, 15 Dec 2021 12:57:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [norov:bm-new1 2/15] drivers/infiniband/sw/siw/siw_main.c:196:6:
 warning: variable 'num_cpus' is used uninitialized whenever 'if' condition
 is false

tree:   https://github.com/norov/linux bm-new1
head:   4c8fba87b160a8063bdd06928dbfc058e26a85db
commit: 80216b2d5ee90bb6dea0aaa7224948f6deb3ae83 [2/15] lib/cpumask: replace cpumask_weight with cpumask_empty where appropriate
config: x86_64-randconfig-a012-20211214 (https://download.01.org/0day-ci/archive/20211215/202112151203.qazbGUpx-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
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://github.com/norov/linux/commit/80216b2d5ee90bb6dea0aaa7224948f6deb3ae83
        git remote add norov https://github.com/norov/linux
        git fetch --no-tags norov bm-new1
        git checkout 80216b2d5ee90bb6dea0aaa7224948f6deb3ae83
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/infiniband/sw/siw/

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 >>):

>> drivers/infiniband/sw/siw/siw_main.c:196:6: warning: variable 'num_cpus' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (cpumask_empty(tx_cpumask)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:201:7: note: uninitialized use occurs here
           if (!num_cpus)
                ^~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:196:2: note: remove the 'if' if its condition is always true
           if (cpumask_empty(tx_cpumask)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:189:17: note: initialize the variable 'num_cpus' to silence this warning
           int i, num_cpus, cpu, min_use, node = sdev->numa_node, tx_cpu = -1;
                          ^
                           = 0
   1 warning generated.


vim +196 drivers/infiniband/sw/siw/siw_main.c

   181	
   182	/*
   183	 * Choose CPU with least number of active QP's from NUMA node of
   184	 * TX interface.
   185	 */
   186	int siw_get_tx_cpu(struct siw_device *sdev)
   187	{
   188		const struct cpumask *tx_cpumask;
   189		int i, num_cpus, cpu, min_use, node = sdev->numa_node, tx_cpu = -1;
   190	
   191		if (node < 0)
   192			tx_cpumask = cpu_online_mask;
   193		else
   194			tx_cpumask = siw_cpu_info.tx_valid_cpus[node];
   195	
 > 196		if (cpumask_empty(tx_cpumask)) {
   197			/* no CPU on this NUMA node */
   198			tx_cpumask = cpu_online_mask;
   199			num_cpus = cpumask_weight(tx_cpumask);
   200		}
   201		if (!num_cpus)
   202			goto out;
   203	
   204		cpu = cpumask_first(tx_cpumask);
   205	
   206		for (i = 0, min_use = SIW_MAX_QP; i < num_cpus;
   207		     i++, cpu = cpumask_next(cpu, tx_cpumask)) {
   208			int usage;
   209	
   210			/* Skip any cores which have no TX thread */
   211			if (!siw_tx_thread[cpu])
   212				continue;
   213	
   214			usage = atomic_read(&per_cpu(siw_use_cnt, cpu));
   215			if (usage <= min_use) {
   216				tx_cpu = cpu;
   217				min_use = usage;
   218			}
   219		}
   220		siw_dbg(&sdev->base_dev,
   221			"tx cpu %d, node %d, %d qp's\n", tx_cpu, node, min_use);
   222	
   223	out:
   224		if (tx_cpu >= 0)
   225			atomic_inc(&per_cpu(siw_use_cnt, tx_cpu));
   226		else
   227			pr_warn("siw: no tx cpu found\n");
   228	
   229		return tx_cpu;
   230	}
   231	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ