public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: replace snprintf("%s") with strscpy
@ 2026-02-22 17:03 Thorsten Blum
  2026-02-23  9:57 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-02-22 17:03 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Thorsten Blum, linux-gpio, linux-kernel

Replace snprintf("%s", ...) with strscpy() for direct string copying.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/gpio/gpiolib.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 3abb90385829..8d1a762f9d11 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -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++)
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-23  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-22 17:03 [PATCH] gpiolib: replace snprintf("%s") with strscpy Thorsten Blum
2026-02-23  9:57 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox