public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: xillybus: use strscpy() in init_chrdev
@ 2026-04-27 17:37 Thorsten Blum
  2026-04-28  8:37 ` Eli Billauer
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-04-27 17:37 UTC (permalink / raw)
  To: Eli Billauer, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Thorsten Blum, linux-kernel

The format specifier is unnecessary and can be removed. Replace
snprintf("%s") with the faster and more direct strscpy().

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

diff --git a/drivers/char/xillybus/xillybus_class.c b/drivers/char/xillybus/xillybus_class.c
index c92a628e389e..bbdfa3e87514 100644
--- a/drivers/char/xillybus/xillybus_class.c
+++ b/drivers/char/xillybus/xillybus_class.c
@@ -11,6 +11,7 @@
 #include <linux/fs.h>
 #include <linux/cdev.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
 
@@ -65,7 +66,7 @@ int xillybus_init_chrdev(struct device *dev,
 	mutex_lock(&unit_mutex);
 
 	if (!enumerate)
-		snprintf(unit->name, UNITNAMELEN, "%s", prefix);
+		strscpy(unit->name, prefix);
 
 	for (i = 0; enumerate; i++) {
 		snprintf(unit->name, UNITNAMELEN, "%s_%02d",

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

end of thread, other threads:[~2026-04-28  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 17:37 [PATCH] char: xillybus: use strscpy() in init_chrdev Thorsten Blum
2026-04-28  8:37 ` Eli Billauer
2026-04-28  8:55   ` Thorsten Blum
2026-04-28  9:05     ` Eli Billauer

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