[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YVy1WkSwfUPyZ2S4@google.com>
Date: Tue, 5 Oct 2021 13:28:10 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Randy Dunlap <rdunlap@...radead.org>,
Zhang Qilong <zhangqilong3@...wei.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Guenter Roeck <linux@...ck-us.net>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RESEND] [v2] Input: analog - fix invalid snprintf() call
On Mon, Sep 27, 2021 at 12:14:06PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.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@...vas.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@...db.de>
Applied, thank you.
--
Dmitry
Powered by blists - more mailing lists