lkml.org 
[lkml]   [2021]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@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

\
 
 \ /
  Last update: 2021-10-05 22:28    [W:0.064 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site