]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpiolib: replace snprintf("%s") with strscpy
authorThorsten Blum <thorsten.blum@linux.dev>
Sun, 22 Feb 2026 17:03:27 +0000 (18:03 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 23 Feb 2026 09:42:55 +0000 (10:42 +0100)
Replace snprintf("%s", ...) with strscpy() for direct string copying.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20260222170327.281576-2-thorsten.blum@linux.dev
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib.h

index 3abb90385829ef5dcb5736ee02e57e537c9544e3..8d1a762f9d11bfc29c9102be02d7b640aa7daad3 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/spinlock.h>
+#include <linux/string.h>
 #include <linux/srcu.h>
 #include <linux/workqueue.h>
 
@@ -107,7 +108,7 @@ extern const char *const gpio_suffixes[];
                if (con_id)                                                             \
                        snprintf(propname, sizeof(propname), "%s-%s", con_id, __gs);    \
                else                                                                    \
-                       snprintf(propname, sizeof(propname), "%s", __gs);               \
+                       strscpy(propname, __gs);                                        \
                1;                                                                      \
             });                                                                        \
             __suffixes++)