Skip to contentSkip to conversation

irq/core:Add a length limitation

PATCH Superseded Liuweni 2 participants 3 messages Nov 24, 2009 – Nov 25, 2009 IRQ

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Liuweni

author
#0 lore raw

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

In the register_handler_proc(), the max length of irqaction->name is MAX_NAMELEN. And this function will call name_unique() to compare name with other irqs'. There is no any code for limitation the length.
I add a warning in the function to notice that the irqaction->name is too long.

---

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

---

Best Regards,
Liuweni
2009-11-24

#1 lore raw
Quoted 14 lines · Liuweni

In the register_handler_proc(), the max length of irqaction->name is MAX_NAMELEN. And this function will call name_unique() to compare name with other irqs'.

There is no any code for limitation the length. I add a warning in the function to notice that the irqaction->name is too long.

---

kernel/irq/proc.c +0 -0
index 0832145..9ab6e04 100644

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

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

Has this situation happened in the past that requires this check to be added? The current limit of 128 chars is quite generous. Also, the check is buggy, it's off by 1.

( Also, please use scripts/checkpatch.pl on patches and please use
'scripts/get_maintainer.pl -f kernel/irq/proc.c' when constructing Cc:
lines. )

Thanks,

Ingo

author
#2 lore raw
In reply to Liuweni

Hi Ingo,
I don't know whether this situation happened in the past.
I upload this code for code Integrity. The WARN_ON is set on OFF, While anybody use it, and set it ON.

Thank you for you suggestion.
I modify the code and use scripts/checkpatch.pl and scripts/get_maintainer.pl on the patch. Please have a check later.

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

发件人: Ingo Molnar
发送时间: 2009-11-24 22:45:38
收件人: Liuweni; Thomas Gleixner
抄送: linux-kernel; xgr178; Jiri Kosina; qingshenlwy 主题: Re: [PATCH]irq/core:Add a length limitation

Quoted 14 lines · Liuweni

In the register_handler_proc(), the max length of irqaction->name is MAX_NAMELEN. And this function will call name_unique() to compare name with other irqs'.

There is no any code for limitation the length. I add a warning in the function to notice that the irqaction->name is too long.

---

kernel/irq/proc.c +0 -0
index 0832145..9ab6e04 100644

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

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

Has this situation happened in the past that requires this check to be
added? The current limit of 128 chars is quite generous. Also, the check
is buggy, it's off by 1.
( Also, please use scripts/checkpatch.pl on patches and please use
'scripts/get_maintainer.pl -f kernel/irq/proc.c' when constructing Cc:
lines. )
Thanks,
Ingo �翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{炳G珴�妠ay�蕠跈�,jf"穐殢飦�戧鐉_璁(殠娸"濟�m���G珴�⒏?櫒璀�&x忈秈O曟瑉窔v豝�m��� �鹅�⒏?朓�