Skip to contentSkip to conversation

sparc32: off by ones in BUG_ON()

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 15, 2016 – Jul 28, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc32: off by ones in BUG_ON()

Smatch complains that these tests are off by one, which is true but not life threatening.

	arch/sparc/kernel/irq_32.c:169 irq_link()
	error: buffer overflow 'irq_map' 384 <= 384
arch/sparc/kernel/irq_32.c +2 -2
index a979e99..cac4a55 100644
@@ -165,7 +165,7 @@ void irq_link(unsigned int irq)
 
 	p = &irq_table[irq];
 	pil = p->pil;
-	BUG_ON(pil > SUN4D_MAX_IRQ);
+	BUG_ON(pil >= SUN4D_MAX_IRQ);
 	p->next = irq_map[pil];
 	irq_map[pil] = p;
 
@@ -182,7 +182,7 @@ void irq_unlink(unsigned int irq)
 	spin_lock_irqsave(&irq_map_lock, flags);
 
 	p = &irq_table[irq];
-	BUG_ON(p->pil > SUN4D_MAX_IRQ);
+	BUG_ON(p->pil >= SUN4D_MAX_IRQ);
 	pnext = &irq_map[p->pil];
 	while (*pnext != p)
 		pnext = &(*pnext)->next;
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Fri, 15 Jul 2016 14:05:33 +0300

Quoted 7 lines

Smatch complains that these tests are off by one, which is true but not life threatening.

	arch/sparc/kernel/irq_32.c:169 irq_link()
	error: buffer overflow 'irq_map' 384 <= 384

Applied, thanks Dan.