All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] nvmem: add support for cell lookups from machine code
@ 2018-10-10 10:06 Dan Carpenter
  2018-10-10 11:05 ` Bartosz Golaszewski
  2018-10-15 13:41 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-10-10 10:06 UTC (permalink / raw)
  To: kernel-janitors

Hello Bartosz Golaszewski,

The patch 506157be06ba: "nvmem: add support for cell lookups from
machine code" from Sep 21, 2018, leads to the following static
checker warning:

	drivers/nvmem/core.c:960 nvmem_cell_get_from_lookup()
	error: 'nvmem' dereferencing possible ERR_PTR()

drivers/nvmem/core.c
   941  
   942          if (!dev)
   943                  return ERR_PTR(-EINVAL);
   944  
   945          dev_id = dev_name(dev);
   946  
   947          mutex_lock(&nvmem_lookup_mutex);
   948  
   949          list_for_each_entry(lookup, &nvmem_lookup_list, node) {
   950                  if ((strcmp(lookup->dev_id, dev_id) = 0) &&
   951                      (strcmp(lookup->con_id, con_id) = 0)) {
   952                          /* This is the right entry. */
   953                          nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This returns error pointers.

   954                          if (!nvmem) {
   955                                  /* Provider may not be registered yet. */
   956                                  cell = ERR_PTR(-EPROBE_DEFER);
   957                                  goto out;
   958                          }
   959  
   960                          cell = nvmem_find_cell_by_name(nvmem,
   961                                                         lookup->cell_name);
   962                          if (!cell) {
   963                                  __nvmem_device_put(nvmem);
   964                                  goto out;
                                        ^^^^^^^^
We probably want to set the error code on this path.

   965                          }
   966                  }
   967          }
   968  
   969  out:
   970          mutex_unlock(&nvmem_lookup_mutex);
   971          return cell;
   972  }
   973  

regards,
dan carpenter

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

* Re: [bug report] nvmem: add support for cell lookups from machine code
  2018-10-10 10:06 [bug report] nvmem: add support for cell lookups from machine code Dan Carpenter
@ 2018-10-10 11:05 ` Bartosz Golaszewski
  2018-10-15 13:41 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2018-10-10 11:05 UTC (permalink / raw)
  To: kernel-janitors

śr., 10 paź 2018 o 12:07 Dan Carpenter <dan.carpenter@oracle.com> napisał(a):
>
> Hello Bartosz Golaszewski,
>
> The patch 506157be06ba: "nvmem: add support for cell lookups from
> machine code" from Sep 21, 2018, leads to the following static
> checker warning:
>
>         drivers/nvmem/core.c:960 nvmem_cell_get_from_lookup()
>         error: 'nvmem' dereferencing possible ERR_PTR()
>
> drivers/nvmem/core.c
>    941
>    942          if (!dev)
>    943                  return ERR_PTR(-EINVAL);
>    944
>    945          dev_id = dev_name(dev);
>    946
>    947          mutex_lock(&nvmem_lookup_mutex);
>    948
>    949          list_for_each_entry(lookup, &nvmem_lookup_list, node) {
>    950                  if ((strcmp(lookup->dev_id, dev_id) == 0) &&
>    951                      (strcmp(lookup->con_id, con_id) == 0)) {
>    952                          /* This is the right entry. */
>    953                          nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
>                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This returns error pointers.
>
>    954                          if (!nvmem) {
>    955                                  /* Provider may not be registered yet. */
>    956                                  cell = ERR_PTR(-EPROBE_DEFER);
>    957                                  goto out;
>    958                          }
>    959
>    960                          cell = nvmem_find_cell_by_name(nvmem,
>    961                                                         lookup->cell_name);
>    962                          if (!cell) {
>    963                                  __nvmem_device_put(nvmem);
>    964                                  goto out;
>                                         ^^^^^^^^
> We probably want to set the error code on this path.
>
>    965                          }
>    966                  }
>    967          }
>    968
>    969  out:
>    970          mutex_unlock(&nvmem_lookup_mutex);
>    971          return cell;
>    972  }
>    973
>
> regards,
> dan carpenter

Hi Dan,

there's already a patch waiting on the list:
https://www.spinics.net/lists/arm-kernel/msg680023.html

Greg, Srinivas: can you pick up this one and this
(https://lkml.org/lkml/2018/10/3/310) for 4.20?

Best regards,
Bartosz Golaszewski

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

* Re: [bug report] nvmem: add support for cell lookups from machine code
  2018-10-10 10:06 [bug report] nvmem: add support for cell lookups from machine code Dan Carpenter
  2018-10-10 11:05 ` Bartosz Golaszewski
@ 2018-10-15 13:41 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-10-15 13:41 UTC (permalink / raw)
  To: kernel-janitors

On Wed, Oct 10, 2018 at 01:05:53PM +0200, Bartosz Golaszewski wrote:
> śr., 10 paź 2018 o 12:07 Dan Carpenter <dan.carpenter@oracle.com> napisał(a):
> >
> > Hello Bartosz Golaszewski,
> >
> > The patch 506157be06ba: "nvmem: add support for cell lookups from
> > machine code" from Sep 21, 2018, leads to the following static
> > checker warning:
> >
> >         drivers/nvmem/core.c:960 nvmem_cell_get_from_lookup()
> >         error: 'nvmem' dereferencing possible ERR_PTR()
> >
> > drivers/nvmem/core.c
> >    941
> >    942          if (!dev)
> >    943                  return ERR_PTR(-EINVAL);
> >    944
> >    945          dev_id = dev_name(dev);
> >    946
> >    947          mutex_lock(&nvmem_lookup_mutex);
> >    948
> >    949          list_for_each_entry(lookup, &nvmem_lookup_list, node) {
> >    950                  if ((strcmp(lookup->dev_id, dev_id) = 0) &&
> >    951                      (strcmp(lookup->con_id, con_id) = 0)) {
> >    952                          /* This is the right entry. */
> >    953                          nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
> >                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > This returns error pointers.
> >
> >    954                          if (!nvmem) {
> >    955                                  /* Provider may not be registered yet. */
> >    956                                  cell = ERR_PTR(-EPROBE_DEFER);
> >    957                                  goto out;
> >    958                          }
> >    959
> >    960                          cell = nvmem_find_cell_by_name(nvmem,
> >    961                                                         lookup->cell_name);
> >    962                          if (!cell) {
> >    963                                  __nvmem_device_put(nvmem);
> >    964                                  goto out;
> >                                         ^^^^^^^^
> > We probably want to set the error code on this path.
> >
> >    965                          }
> >    966                  }
> >    967          }
> >    968
> >    969  out:
> >    970          mutex_unlock(&nvmem_lookup_mutex);
> >    971          return cell;
> >    972  }
> >    973
> >
> > regards,
> > dan carpenter
> 
> Hi Dan,
> 
> there's already a patch waiting on the list:
> https://www.spinics.net/lists/arm-kernel/msg680023.html
> 
> Greg, Srinivas: can you pick up this one and this
> (https://lkml.org/lkml/2018/10/3/310) for 4.20?

Sorry for the delay, will get to that today.

greg k-h

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

end of thread, other threads:[~2018-10-15 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 10:06 [bug report] nvmem: add support for cell lookups from machine code Dan Carpenter
2018-10-10 11:05 ` Bartosz Golaszewski
2018-10-15 13:41 ` Greg KH

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.