cyclades: fix read buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Thu, 1 Oct 2009 22:44:24 +0000 (15:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 1 Oct 2009 23:11:16 +0000 (16:11 -0700)
irq is declared with size NR_CARDS (4), but the loop containing this
segment runs up until NR_ISA_ADDRS (16), possibly reading from irq[i] (and
trying to use the result)

Identified by the Parfait static scanner.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/cyclades.c

index df5038b..4254457 100644 (file)
@@ -3354,7 +3354,7 @@ static int __init cy_detect_isa(void)
                        continue;
                }
 #ifdef MODULE
-               if (isparam && irq[i])
+               if (isparam && i < NR_CARDS && irq[i])
                        cy_isa_irq = irq[i];
                else
 #endif