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-prev] [day] [month] [year] [list]
Date:   Mon, 1 Oct 2018 18:10:45 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     David Lechner <david@...hnology.com>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        "David S . Miller" <davem@...emloft.net>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Jonathan Corbet <corbet@....net>, Sekhar Nori <nsekhar@...com>,
        Kevin Hilman <khilman@...nel.org>,
        Boris Brezillon <boris.brezillon@...tlin.com>,
        Andrew Lunn <andrew@...n.ch>, Alban Bedel <albeu@...e.fr>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Chen-Yu Tsai <wens@...e.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        linux-doc <linux-doc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH] nvmem: fix nvmem_cell_get_from_lookup()

pon., 1 paź 2018 o 18:03 David Lechner <david@...hnology.com> napisał(a):
>
> On 10/01/2018 05:00 AM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> >
> > We check if the pointer returned by __nvmem_device_get() is not NULL
> > while we should actually check if it is not IS_ERR(nvmem). Fix it.
> >
> > While we're at it: fix the next error path where we should assign an
> > error value to cell before returning.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> > ---
> >   drivers/nvmem/core.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> > index ad1227df1984..8249621d11a6 100644
> > --- a/drivers/nvmem/core.c
> > +++ b/drivers/nvmem/core.c
> > @@ -952,9 +952,9 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
> >                   (strcmp(lookup->con_id, con_id) == 0)) {
> >                       /* This is the right entry. */
> >                       nvmem = __nvmem_device_get(NULL, lookup->nvmem_name);
> > -                     if (!nvmem) {
> > +                     if (IS_ERR(nvmem)) {
> >                               /* Provider may not be registered yet. */
> > -                             cell = ERR_PTR(-EPROBE_DEFER);
> > +                             cell = (struct nvmem_cell *)nvmem;
>
> perhaps ERR_CAST() would better indicate the intent here?
>

Wow so that exists too...

Thanks, I'll resend tomorrow.

Bart

> >                               goto out;
> >                       }
> >
> > @@ -962,6 +962,7 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id)
> >                                                      lookup->cell_name);
> >                       if (!cell) {
> >                               __nvmem_device_put(nvmem);
> > +                             cell = ERR_PTR(-ENOENT);
> >                               goto out;
> >                       }
> >               }
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ