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] [thread-next>] [day] [month] [year] [list]
Date: Fri, 16 Feb 2024 17:17:06 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: "Bartosz Golaszewski" <brgl@...ev.pl>, "Arnd Bergmann" <arnd@...nel.org>,
 "Linus Walleij" <linus.walleij@...aro.org>,
 "Kent Gibson" <warthog618@...il.com>,
 "Andy Shevchenko" <andriy.shevchenko@...ux.intel.com>,
 "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: cdev: avoid uninitialized variable dereference

On Fri, Feb 16, 2024, at 16:51, Paul E. McKenney wrote:
> On Fri, Feb 16, 2024 at 03:04:14PM +0100, Arnd Bergmann wrote:
>> On Fri, Feb 16, 2024, at 14:19, Bartosz Golaszewski wrote:
>> > On Fri, Feb 16, 2024 at 2:00 PM Arnd Bergmann <arnd@...nel.org> wrote:
>> >>
>> >> From: Arnd Bergmann <arnd@...db.de>
>> >>
>> >> The 'gc' variable is never set before it gets printed:
>> >>
>> >> drivers/gpio/gpiolib-cdev.c:2802:11: error: variable 'gc' is uninitialized when used here [-Werror,-Wuninitialized]
>> >>  2802 |         chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
>> >>       |                  ^~
>> >> drivers/gpio/gpiolib.h:277:11: note: expanded from macro 'chip_dbg'
>> >>   277 |         dev_dbg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
>> >>       |                  ^~
>> >>
>> >> Use dev_dbg() directly.
>> >>
>> >> Fixes: 8574b5b47610 ("gpio: cdev: use correct pointer accessors with SRCU")
>> >> Signed-off-by: Arnd Bergmann <arnd@...db.de>
>> >> ---
>> >
>> > I seem to have beat you to it[1] and my patch doesn't change the log
>> > message so I'll apply it instead of this one.
>> 
>> Ok, thanks. I thought about doing this, but could not
>> figure out which of the RCU primitives to use.
>
> I will count that as a bug against RCU's documentation, but I am not
> sure how to fix it.  Thoughts?

I didn't really try at all, I just figured I could avoid
thinking about it by using the device pointer at hand.

I'm sure the docs would have told me if I had bothered to look.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ