linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [cxl:preview 30/54] drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.
@ 2022-01-26 10:08 Dan Carpenter
  2022-01-26 15:38 ` Dan Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-01-26 10:08 UTC (permalink / raw)
  To: kbuild, Dan Williams
  Cc: lkp, kbuild-all, Alison Schofield, Vishal Verma, Ira Weiny,
	Ben Widawsky, Dan Williams, linux-kernel

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [cxl:preview 30/54] drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.
  2022-01-26 10:08 [cxl:preview 30/54] drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock' Dan Carpenter
@ 2022-01-26 15:38 ` Dan Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2022-01-26 15:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild, kbuild test robot, kbuild-all, Alison Schofield,
	Vishal Verma, Ira Weiny, Ben Widawsky, Linux Kernel Mailing List

On Wed, Jan 26, 2022 at 2:09 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> smatch warnings:
> drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock'.

This report is too late. The branch was posted on the 22nd. The bug
was already found and fixed manually:

https://lore.kernel.org/r/164316562430.3437160.122223070771602475.stgit@dwillia2-desk3.amr.corp.intel.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 10:08 [cxl:preview 30/54] drivers/cxl/core/port.c:527 decoder_populate_targets() warn: inconsistent returns '&cxld->target_lock.lock' Dan Carpenter
2022-01-26 15:38 ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).