All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456 (fwd)
@ 2020-04-17 17:05 Julia Lawall
  2020-04-17 17:12 ` Todd Kjos
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-04-17 17:05 UTC (permalink / raw)
  To: kbuild-all

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

If the iteration on line 456 reaches the end of the list, cell will be an
invalid value somewhere in the middle of or above the list head.

The initialization of cell to NULL is also unnecessary, since no one will
ever see that value.

This seems to be quite old code.  I don't know why the error is showing up
now

julia

---------- Forwarded message ----------
Date: Fri, 17 Apr 2020 10:44:42 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR:
     invalid reference to the index variable of the iterator on line 456

CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com

tree:   https://android.googlesource.com/kernel/common android-4.19
head:   824a6c4cdf73abdd188b5a1e55fba7c63e18ea81
commit: 0fc0aae624eca1b9f56a962628c36b8b8829afa0 [1/3] BACKPORT: nvmem: resolve cells from DT at registration time
:::::: branch date: 7 weeks ago
:::::: commit date: 7 weeks ago

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456

git remote add android-common https://android.googlesource.com/kernel/common
git remote update android-common
git checkout 0fc0aae624eca1b9f56a962628c36b8b8829afa0
vim +462 drivers/nvmem/core.c

b6c217ab9be689 Andrew Lunn         2016-02-26  448
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  449  static struct nvmem_cell *
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  450  nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  451  {
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  452  	struct nvmem_cell *cell = NULL;
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  453  	int i = 0;
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  454
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  455  	mutex_lock(&nvmem_mutex);
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21 @456  	list_for_each_entry(cell, &nvmem_cells, node) {
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  457  		if (index == i++)
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  458  			break;
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  459  	}
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  460  	mutex_unlock(&nvmem_mutex);
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  461
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21 @462  	return cell;
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  463  }
0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  464

---
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] 3+ messages in thread

* Re: [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456 (fwd)
  2020-04-17 17:05 [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456 (fwd) Julia Lawall
@ 2020-04-17 17:12 ` Todd Kjos
  2020-04-18 17:35   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Todd Kjos @ 2020-04-17 17:12 UTC (permalink / raw)
  To: kbuild-all

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

+Mark Salyzyn

Julia,

Thanks for the analysis. It probably popped up in 0-day because this
patch was recently cherry-picked into the android-4.19 branch.

-Todd


On Fri, Apr 17, 2020 at 10:05 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> If the iteration on line 456 reaches the end of the list, cell will be an
> invalid value somewhere in the middle of or above the list head.
>
> The initialization of cell to NULL is also unnecessary, since no one will
> ever see that value.
>
> This seems to be quite old code.  I don't know why the error is showing up
> now
>
> julia
>
> ---------- Forwarded message ----------
> Date: Fri, 17 Apr 2020 10:44:42 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild(a)lists.01.org
> Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
> Subject: [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR:
>      invalid reference to the index variable of the iterator on line 456
>
> CC: kbuild-all(a)lists.01.org
> TO: cros-kernel-buildreports(a)googlegroups.com
>
> tree:   https://android.googlesource.com/kernel/common android-4.19
> head:   824a6c4cdf73abdd188b5a1e55fba7c63e18ea81
> commit: 0fc0aae624eca1b9f56a962628c36b8b8829afa0 [1/3] BACKPORT: nvmem: resolve cells from DT at registration time
> :::::: branch date: 7 weeks ago
> :::::: commit date: 7 weeks ago
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
>
>
> coccinelle warnings: (new ones prefixed by >>)
>
> >> drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456
>
> git remote add android-common https://android.googlesource.com/kernel/common
> git remote update android-common
> git checkout 0fc0aae624eca1b9f56a962628c36b8b8829afa0
> vim +462 drivers/nvmem/core.c
>
> b6c217ab9be689 Andrew Lunn         2016-02-26  448
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  449  static struct nvmem_cell *
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  450  nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  451  {
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  452      struct nvmem_cell *cell = NULL;
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  453      int i = 0;
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  454
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  455      mutex_lock(&nvmem_mutex);
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21 @456      list_for_each_entry(cell, &nvmem_cells, node) {
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  457              if (index == i++)
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  458                      break;
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  459      }
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  460      mutex_unlock(&nvmem_mutex);
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  461
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21 @462      return cell;
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  463  }
> 0fc0aae624eca1 Bartosz Golaszewski 2018-09-21  464
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
> --
> You received this message because you are subscribed to the Google Groups "cros-kernel-buildreports" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cros-kernel-buildreports+unsubscribe(a)googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/cros-kernel-buildreports/alpine.DEB.2.21.2004171901260.4325%40hadrien.

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

* Re: [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456 (fwd)
  2020-04-17 17:12 ` Todd Kjos
@ 2020-04-18 17:35   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-04-18 17:35 UTC (permalink / raw)
  To: kbuild-all

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

pt., 17 kwi 2020 o 19:12 Todd Kjos <tkjos@google.com> napisał(a):
>
> +Mark Salyzyn
>
> Julia,
>
> Thanks for the analysis. It probably popped up in 0-day because this
> patch was recently cherry-picked into the android-4.19 branch.
>
> -Todd
>

FYI The fix for this is upstream commit 0749aa25af82c ("nvmem: core:
fix regression in of_nvmem_cell_get()").

Bart

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

end of thread, other threads:[~2020-04-18 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 17:05 [android-common:android-4.19 1/3] drivers/nvmem/core.c:462:8-12: ERROR: invalid reference to the index variable of the iterator on line 456 (fwd) Julia Lawall
2020-04-17 17:12 ` Todd Kjos
2020-04-18 17:35   ` Bartosz Golaszewski

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.