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:   Wed, 5 Aug 2020 16:04:28 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     trix@...hat.com
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Frank Rowand <frank.rowand@...y.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: of: reset name variable in of_gpiochip_add_hog

Hi Tom,

Thanks for your patch!

On Tue, Jul 28, 2020 at 3:42 PM <trix@...hat.com> wrote:
> From: Tom Rix <trix@...hat.com>
>
> Clang static analysis reports this error
>
> gpiolib-of.c:664:9: warning: 2nd function call argument
>   is an uninitialized value [core.CallAndMessage]
>         ret = gpiod_hog(desc, name, lflags, dflags);
>
> name is sometimes set by of_parse_own_gpio
> name is always used by gpiod_hog

This is a false-positive: gpiod_hog() is only called if
of_parse_own_gpio() returned success, in which case it has filled in the
name output parameter.

> So it is necessary to reset name so an old value is
> not mistakenly used by gpiod_hog.

Hence this is not needed.

> Fixes: bc21077e084b ("gpio: of: Extract of_gpiochip_add_hog()")

This is not the commit that introduced the "bug".

> Signed-off-by: Tom Rix <trix@...hat.com>

> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -657,6 +657,7 @@ static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog)
>         int ret;
>
>         for (i = 0;; i++) {
> +               name = NULL;
>                 desc = of_parse_own_gpio(hog, chip, i, &name, &lflags, &dflags);
>                 if (IS_ERR(desc))
>                         break;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ