From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
Randy Dunlap <rdunlap@infradead.org>,
Zhang Qilong <zhangqilong3@huawei.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Guenter Roeck <linux@roeck-us.net>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] [v2] Input: analog - fix invalid snprintf() call
Date: Tue, 5 Oct 2021 13:28:10 -0700 [thread overview]
Message-ID: <YVy1WkSwfUPyZ2S4@google.com> (raw)
In-Reply-To: <20210927101416.1569609-1-arnd@kernel.org>
On Mon, Sep 27, 2021 at 12:14:06PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Overlapping input and output arguments to snprintf() are
> undefined behavior in C99:
>
> drivers/input/joystick/analog.c: In function 'analog_name':
> drivers/input/joystick/analog.c:428:3: error: 'snprintf' argument 4 overlaps destination object 'analog' [-Werror=restrict]
> 428 | snprintf(analog->name, sizeof(analog->name), "%s %d-hat",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 429 | analog->name, hweight16(analog->mask & ANALOG_HATS_ALL));
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/input/joystick/analog.c:420:40: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
> 420 | static void analog_name(struct analog *analog)
> | ~~~~~~~~~~~~~~~^~~~~~
>
> Change this function to use the simpler seq_buf interface instead.
>
> Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Link: https://lore.kernel.org/all/20210323131456.2600132-1-arnd@kernel.org/
> Link: https://lore.kernel.org/all/20210324131959.2089129-1-arnd@kernel.org/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2021-10-05 20:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 10:14 [PATCH] [RESEND] [v2] Input: analog - fix invalid snprintf() call Arnd Bergmann
2021-10-05 20:28 ` Dmitry Torokhov [this message]
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=YVy1WkSwfUPyZ2S4@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=geert+renesas@glider.be \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rasmus.villemoes@prevas.dk \
--cc=rdunlap@infradead.org \
--cc=zhangqilong3@huawei.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 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.