kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] sparc32: off by ones in BUG_ON()
@ 2016-07-15 11:05 Dan Carpenter
  2016-07-28  5:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-15 11:05 UTC (permalink / raw)
  To: kernel-janitors

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>

diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index a979e99..cac4a55 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] sparc32: off by ones in BUG_ON()
  2016-07-15 11:05 [patch] sparc32: off by ones in BUG_ON() Dan Carpenter
@ 2016-07-28  5:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-07-28  5:53 UTC (permalink / raw)
  To: kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 15 Jul 2016 14:05:33 +0300

> 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>

Applied, thanks Dan.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-28  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 11:05 [patch] sparc32: off by ones in BUG_ON() Dan Carpenter
2016-07-28  5:53 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).