sparc32: off by ones in BUG_ON()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 Jul 2016 11:05:33 +0000 (14:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Jul 2016 05:53:17 +0000 (22:53 -0700)
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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/irq_32.c

index a979e99f8751cd60393c1ee18c0a958ceddb34cf..cac4a5554c0ea0533247b79d64d93612171e93ac 100644 (file)
@@ -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;