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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202201250055.R82EBqL1-lkp@intel.com>
Date:   Wed, 26 Jan 2022 13:08:33 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Dan Williams <dan.j.williams@...el.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        Alison Schofield <alison.schofield@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Ira Weiny <ira.weiny@...el.com>,
        Ben Widawsky <ben.widawsky@...el.com>,
        Dan Williams <dan.j.williams@...el.com>,
        linux-kernel@...r.kernel.org
Subject: [cxl:preview 30/54] drivers/cxl/core/port.c:527
 decoder_populate_targets() warn: inconsistent returns
 '&cxld->target_lock.lock'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git preview
head:   d0687472d5b56e2018b833723082c2717e96c074
commit: a5d24e660f35f16cfe30031dcbd7356f7a002398 [30/54] cxl/core/port: Use dedicated lock for decoder target list
config: s390-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220125/202201250055.R82EBqL1-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 11.2.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/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.

vim +527 drivers/cxl/core/port.c

48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  498  static int decoder_populate_targets(struct cxl_decoder *cxld,
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  499  				    struct cxl_port *port, int *target_map)
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  500  {
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  501  	int rc = 0, i;
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  502  
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  503  	if (!target_map)
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  504  		return 0;
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  505  
42c377a63d21df drivers/cxl/core/port.c Dan Williams 2022-01-05  506  	cxl_device_lock(&port->dev);
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  507  	if (list_empty(&port->dports)) {
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  508  		rc = -EINVAL;
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  509  		goto out_unlock;
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  510  	}
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  511  
a5d24e660f35f1 drivers/cxl/core/port.c Dan Williams 2022-01-21  512  	write_seqlock(&cxld->target_lock);

Lock

48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  513  	for (i = 0; i < cxld->nr_targets; i++) {
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  514  		struct cxl_dport *dport = find_dport(port, target_map[i]);
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  515  
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  516  		if (!dport) {
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  517  			rc = -ENXIO;
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  518  			goto out_unlock;

Missing write_sequnlock() on this path

a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  519  		}
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  520  		cxld->target[i] = dport;
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  521  	}
a5d24e660f35f1 drivers/cxl/core/port.c Dan Williams 2022-01-21  522  	write_sequnlock(&cxld->target_lock);
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  523  
48667f676189ec drivers/cxl/core/bus.c  Dan Williams 2021-09-21  524  out_unlock:
42c377a63d21df drivers/cxl/core/port.c Dan Williams 2022-01-05  525  	cxl_device_unlock(&port->dev);
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  526  
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08 @527  	return rc;
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  528  }

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