Skip to contentSkip to conversation

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

PATCH New Eric Sesterhenn 1 participant 1 message Apr 9, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Wrong out of range check in drivers/char/applicom.c

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.

drivers/char/applicom.c renamed from drivers/char/applicom.c.orig +1 -1
@@ -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;