Skip to content
Commit 3ae08e47 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Bartosz Golaszewski
Browse files

gpio: virtuser: avoid non-constant format string



Using a string variable as an sprintf format is potentially
dangerous, and gcc can warn about this:

drivers/gpio/gpio-virtuser.c: In function 'gpio_virtuser_dbgfs_init_line_attrs':
drivers/gpio/gpio-virtuser.c:808:9: error: format not a string literal and no format arguments [-Werror=format-security]
  808 |         sprintf(data->consumer, id);
      |         ^~~~~~~

Change it to a simpler strscpy() instead to just copy it and check
the destination buffer size.

Fixes: 91581c4b ("gpio: virtuser: new virtual testing driver for the GPIO API")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240719144422.2082394-1-arnd@kernel.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent b3c0eccb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment