Skip to contentSkip to conversation

bug in xnintr_irq_proc()

PATCH In review Wolfgang Grandegger 2 participants 3 messages Jan 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug in xnintr_irq_proc()

Hello,

attached is a fix for a nice bug in xnintr_irq_proc() of Xenomai v2.3.x. Check for tabs. I have not checked if it's present in recent versions as well.

Wolfgang.

nucleus/intr.c +2 -2
Index: ksrc/nucleus/intr.c
===================================================================
@@ -836,7 +836,7 @@ int xnintr_irq_proc(unsigned int irq, ch
 #if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL) || defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
 	intr = xnirqs[irq].handlers;
 	if (intr) {
-		strcpy(p, "	   "); p += 8;
+		strcpy(p, "	   "); p += 4;
 
 		do {
 			*p = ' '; p += 1;
@@ -848,7 +848,7 @@ int xnintr_irq_proc(unsigned int irq, ch
 #else /* !CONFIG_XENO_OPT_SHIRQ_LEVEL && !CONFIG_XENO_OPT_SHIRQ_EDGE */
 	intr = rthal_irq_cookie(&rthal_domain, irq);
 	if (intr) {
-		strcpy(p, "	    "); p += 9;
+		strcpy(p, "	    "); p += 5;
 		strcpy(p, intr->name); p += strlen(intr->name);
 	}
 #endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL || CONFIG_XENO_OPT_SHIRQ_EDGE */
#1 lore raw
Quoted 3 lines · Wolfgang Grandegger

Hello,

attached is a fix for a nice bug in xnintr_irq_proc() of Xenomai v2.3.x.

Mmf... Thanks.

Quoted 2 lines

Check for tabs. I have not checked if it's present in recent versions as well.

Even if a bit overkill, I would even go for something like p += sprintf(p, "...
just to be sure we won't get hit again.

(or even snprintf() for the paranoïds among us).

Quoted 10 lines

Wolfgang.

------------------------------------------------------------------------

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.
#2 lore raw
Quoted 5 lines · Philippe Gerum
Quoted 3 lines · Wolfgang Grandegger

Hello,

attached is a fix for a nice bug in xnintr_irq_proc() of Xenomai v2.3.x.

Quoted 8 lines

Mmf... Thanks.

Quoted 2 lines

Check for tabs. I have not checked if it's present in recent versions as well.

Even if a bit overkill, I would even go for something like p += sprintf(p, "...
just to be sure we won't get hit again.

Yes, and replacing the tabs with "\t" in case we need them. They seem to be gone in the trunk.

Quoted 1 line

(or even snprintf() for the paranoïds among us).

Definitely, especially because the name field of xnintr_t is a pointer.

Wolfgang.