Skip to contentSkip to conversation

genirq/proc:Replace snprintf with strscpy

PATCH In review qiubowen 2 participants 2 messages Feb 3 IRQ

lore
Share & tools
lore

qiubowen

author
#0 lore raw

PATCH 1/1 genirq/proc:Replace snprintf with strscpy

Replace snprintf with strscpy for better performance.

---
 kernel/irq/proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/irq/proc.c +2 -1
index 77258eafbf63..6aa974d2a01e 100644
@@ -12,6 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/mutex.h>
+#include <linux/string.h>
 
 #include "internals.h"
 
@@ -317,7 +318,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 	if (!desc->dir || action->dir || !action->name || !name_unique(irq, action))
 		return;
 
-	snprintf(name, MAX_NAMELEN, "%s", action->name);
+	strscpy(name, action->name, MAX_NAMELEN);
 
 	/* create /proc/irq/1234/handler/ */
 	action->dir = proc_mkdir(name, desc->dir);
Signature · 1 line
2.43.0