Commit 3ae08e4
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: 91581c4 ("gpio: virtuser: new virtual testing driver for the GPIO API")
Signed-off-by: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>1 parent b3c0ecc commit 3ae08e4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
| 808 | + | |
809 | 809 | | |
810 | 810 | | |
811 | 811 | | |
| |||
0 commit comments