All of lore.kernel.org
 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
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-01-24 16:13 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4438 bytes --]

CC: kbuild-all(a)lists.01.org
CC: Alison Schofield <alison.schofield@intel.com>
CC: Vishal Verma <vishal.l.verma@intel.com>
CC: Ira Weiny <ira.weiny@intel.com>
CC: Ben Widawsky <ben.widawsky@intel.com>
CC: Dan Williams <dan.j.williams@intel.com>
CC: linux-kernel(a)vger.kernel.org
TO: Dan Williams <dan.j.williams@intel.com>

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
:::::: branch date: 2 days ago
:::::: commit date: 3 days ago
config: s390-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220125/202201250055.R82EBqL1-lkp(a)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

7d4b5ca2e2cb5d drivers/cxl/core.c      Dan Williams 2021-06-09  497  
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);
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;
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  }
a5c25802168993 drivers/cxl/core/bus.c  Dan Williams 2021-09-08  529  

:::::: The code at line 527 was first introduced by commit
:::::: a5c25802168993c67a03a6e04142761dfb4a3bf5 cxl/bus: Populate the target list at decoder create

:::::: TO: Dan Williams <dan.j.williams@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>

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

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

* [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
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

* [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
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-01-26 10:08 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3684 bytes --]

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(a)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(a)lists.01.org

^ permalink raw reply	[flat|nested] 5+ 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 ` Dan Carpenter
@ 2022-01-26 15:38   ` Dan Williams
  -1 siblings, 0 replies; 5+ 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] 5+ 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 15:38   ` Dan Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2022-01-26 15:38 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]

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(a)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(a)dwillia2-desk3.amr.corp.intel.com

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

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

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.