[Patch] Wrong out of range check in drivers/char/applicom.c

From: Eric Sesterhenn
Date: Sun Apr 09 2006 - 13:08:10 EST


hi,

this fixes coverity bug id #469. The out of range check didnt
work as intended, as seen by the printk(), which states that
boardno has to be 1 <= boardno <= MAX_BOARD.

Signed-off-by: Eric Sesterhenn <snakebyte@xxxxxx>

--- linux-2.6.17-rc1/drivers/char/applicom.c.orig 2006-04-09 18:57:29.000000000 +0200
+++ linux-2.6.17-rc1/drivers/char/applicom.c 2006-04-09 18:57:55.000000000 +0200
@@ -142,7 +142,7 @@ static int ac_register_board(unsigned lo
if (!boardno)
boardno = readb(loc + NUMCARD_OWNER_TO_PC);

- if (!boardno && boardno > MAX_BOARD) {
+ if (!boardno || boardno > MAX_BOARD) {
printk(KERN_WARNING "Board #%d (at 0x%lx) is out of range (1 <= x <= %d).\n",
boardno, physloc, MAX_BOARD);
return 0;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/