summaryrefslogtreecommitdiff
path: root/kernel/irq
diff options
context:
space:
mode:
authorPengpeng Hou <pengpeng@iscas.ac.cn>2026-04-03 16:55:56 +0800
committerThomas Gleixner <tglx@kernel.org>2026-05-11 16:32:30 +0200
commitc2c7983c93f5d86962318be7e7298f1bc3feb1a6 (patch)
tree9f80a9fef6fdd3a60c30ab96628fdb54ef92a5a1 /kernel/irq
parent254f49634ee16a731174d2ae34bc50bd5f45e731 (diff)
downloadlinux-next-c2c7983c93f5d86962318be7e7298f1bc3feb1a6.tar.gz
linux-next-c2c7983c93f5d86962318be7e7298f1bc3feb1a6.zip
genirq/proc: Size interrupt directory names for 10-digit interrupt numbers
/proc/irq/<n>/ directory names are built in `char name[10]` buffers with `sprintf(name, "%u", irq)`. Ten-digit IRQ numbers already need 11 bytes including the trailing NUL, and current sparse-IRQ configurations allow interrupt numbers in that range. Size the temporary name buffer for the current decimal form and switch to bounded formatting when creating or removing the proc entry. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260404101001.1-genirq-proc-pengpeng@iscas.ac.cn
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index b0999a4f1f68..dfa0b0723642 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -10,6 +10,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/interrupt.h>
+#include <linux/kernel.h>
#include <linux/kernel_stat.h>
#include <linux/mutex.h>
#include <linux/string.h>
@@ -326,7 +327,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
#undef MAX_NAMELEN
-#define MAX_NAMELEN 10
+#define MAX_NAMELEN 11
void register_irq_proc(unsigned int irq, struct irq_desc *desc)
{
@@ -348,7 +349,7 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
return;
/* create /proc/irq/1234 */
- sprintf(name, "%u", irq);
+ snprintf(name, MAX_NAMELEN, "%u", irq);
desc->dir = proc_mkdir(name, root_irq_dir);
if (!desc->dir)
return;
@@ -401,7 +402,7 @@ void unregister_irq_proc(unsigned int irq, struct irq_desc *desc)
#endif
remove_proc_entry("spurious", desc->dir);
- sprintf(name, "%u", irq);
+ snprintf(name, MAX_NAMELEN, "%u", irq);
remove_proc_entry(name, root_irq_dir);
}