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: <202110112106.CuCZQB5D-lkp@intel.com>
Date:   Mon, 11 Oct 2021 16:49:07 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Kishon Vijay Abraham I <kishon@...com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Vignesh Raghavendra <vigneshr@...com>
Subject: [ti:ti-rt-linux-5.10.y 4405/9998]
 drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn:
 inconsistent returns '&epf_pf->lock'.

tree:   git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.10.y
head:   7ff055c5f01acc96255948cdd632c72fd78a1f72
commit: 0cf43e35b1743dc43574089fcf3ff71d8cd2ae39 [4405/9998] PCI: endpoint: Add support to add virtual function in endpoint core
config: x86_64-randconfig-m001-20211011 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock'.

vim +169 drivers/pci/endpoint/pci-epf-core.c

0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  141  int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  142  {
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  143  	u32 vfunc_no;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  144  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  145  	if (IS_ERR_OR_NULL(epf_pf) || IS_ERR_OR_NULL(epf_vf))
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  146  		return -EINVAL;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  147  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  148  	if (epf_pf->epc || epf_vf->epc || epf_vf->epf_pf)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  149  		return -EBUSY;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  150  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  151  	if (epf_pf->sec_epc || epf_vf->sec_epc)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  152  		return -EBUSY;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  153  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  154  	mutex_lock(&epf_pf->lock);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  155  	vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  156  				       BITS_PER_LONG);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  157  	if (vfunc_no >= BITS_PER_LONG)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  158  		return -EINVAL;

Unlock before returning.

0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  159  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  160  	set_bit(vfunc_no, &epf_pf->vfunction_num_map);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  161  	epf_vf->vfunc_no = vfunc_no;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  162  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  163  	epf_vf->epf_pf = epf_pf;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  164  	epf_vf->is_vf = true;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  165  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  166  	list_add_tail(&epf_vf->list, &epf_pf->pci_vepf);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  167  	mutex_unlock(&epf_pf->lock);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  168  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30 @169  	return 0;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  170  }

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