[PATCH] genirq/proc:Replace snprintf with strscpy

qiubowen posted 1 patch 4 days, 22 hours ago
kernel/irq/proc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] genirq/proc:Replace snprintf with strscpy
Posted by qiubowen 4 days, 22 hours ago
Replace snprintf with strscpy for better performance.

Signed-off-by: qiubowen <qiubowen523@gmail.com>
---
 kernel/irq/proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 77258eafbf63..6aa974d2a01e 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -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);
-- 
2.43.0
Re: [PATCH] genirq/proc:Replace snprintf with strscpy
Posted by Thomas Gleixner 4 days, 20 hours ago
On Tue, Feb 03 2026 at 19:20, qiubowen wrote:

> Replace snprintf with strscpy for better performance.

Seems to be a new script drawing attention, but you might at least check
against -next of the irq/core branch to figure out whether this has been
addressed already.

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=irq/core&id=2dfc417414c6eea4e167b2f46283cded846c531a