Skip to contentSkip to conversation

irq/core: Add a length limitation

PATCH In review Liuweni 3 participants 3 messages Nov 25, 2009 IRQ

lore
Share & tools
lore

Liuweni

author
#0 lore raw

PATCH v2 1/1 irq/core: Add a length limitation

---
In this version, I modify the code by Ingo's suggestion, and less code add.
The code will check the irqaction->name's length and avoid Using too long name without any notice.
---

Cc Ingo Molnar <[email protected]>
Cc Rusty Russell <[email protected]>
Cc Mike Travis <[email protected]>
Cc Alexey Dobriyan <[email protected]>
Cc Thomas Gleixner <[email protected]>

---

kernel/irq/proc.c +2 -0
index 0832145..b91dcb1 100644
@@ -196,6 +196,8 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 	char name [MAX_NAMELEN];
 	struct irq_desc *desc = irq_to_desc(irq);
 
+	WARN_ON(strlen(action->name) < MAX_NAMELEN);
+
 	if (!desc->dir || action->dir || !action->name ||
 					!name_unique(irq, action))
 		return;

--------------
Best Regards,
Liuweni
2009-11-25

#1 lore raw
Quoted 9 lines · Liuweni

---
In this version, I modify the code by Ingo's suggestion, and less code add.
The code will check the irqaction->name's length and avoid Using too long name without any notice.

kernel/irq/proc.c void register_handler_proc(unsigned int irq, struct irqaction *action) · line 200

Quoted 5 lines
kernel/irq/proc.c +2 -0
@@ -196,6 +196,8 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 	char name [MAX_NAMELEN];
 	struct irq_desc *desc = irq_to_desc(irq);
 
+	WARN_ON(strlen(action->name) < MAX_NAMELEN);
+

This is going to warn on every action->name which is actually used in the kernel except for the ones which are too long.

Thanks,

tglx

#2 lore raw
Quoted 14 lines · Thomas Gleixner
Quoted 12 lines · Liuweni

 ---
In this version, I modify the code by Ingo's suggestion, and less code add.
The code will check the irqaction->name's length and avoid Using too long name without any notice.

kernel/irq/proc.c +0 -0
@@ -196,6 +196,8 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
       char name [MAX_NAMELEN];
       struct irq_desc *desc = irq_to_desc(irq);
 
Quoted 6 lines

kernel/irq/proc.c void register_handler_proc(unsigned int irq, struct irqaction *action) · line 200

Quoted 2 lines
kernel/irq/proc.c +2 -0
+     WARN_ON(strlen(action->name) < MAX_NAMELEN);
+

This is going to warn on every action->name which is actually used in the kernel except for the ones which are too long.

Even we add WARN_ON(strlen(action->name) > MAX_NAMELEN), I think it doesn't affect the runtime things, what it could tell is that there maybe two different irqs
with the same name showed under /proc

Thanks,
Yong

Quoted 11 lines

Thanks,

       tglx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/