mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
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
This commit is contained in:
parent
254f49634e
commit
c2c7983c93
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user