From: "Arnd Bergmann" <arnd@arndb.de>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Arnd Bergmann" <arnd@kernel.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Kent Gibson" <warthog618@gmail.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpio: cdev: avoid uninitialized variable dereference
Date: Fri, 16 Feb 2024 17:17:06 +0100 [thread overview]
Message-ID: <20c18087-dc18-4671-b4ac-c54f7fe4ad21@app.fastmail.com> (raw)
In-Reply-To: <c6290c26-8d06-4032-8599-83556d44687c@paulmck-laptop>
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@kernel.org> wrote:
>> >>
>> >> From: Arnd Bergmann <arnd@arndb.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@arndb.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
next prev parent reply other threads:[~2024-02-16 16:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 12:59 Arnd Bergmann
2024-02-16 13:19 ` Bartosz Golaszewski
2024-02-16 14:04 ` Arnd Bergmann
2024-02-16 15:51 ` Paul E. McKenney
2024-02-16 16:17 ` Arnd Bergmann [this message]
2024-02-16 16:50 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20c18087-dc18-4671-b4ac-c54f7fe4ad21@app.fastmail.com \
--to=arnd@arndb.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@kernel.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=warthog618@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®