Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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@gmx.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Eric Sesterhenn and committed by
Linus Torvalds
e60b6e2f fd5403c7

+1 -1
+1 -1
drivers/char/applicom.c
··· 142 142 if (!boardno) 143 143 boardno = readb(loc + NUMCARD_OWNER_TO_PC); 144 144 145 - if (!boardno && boardno > MAX_BOARD) { 145 + if (!boardno || boardno > MAX_BOARD) { 146 146 printk(KERN_WARNING "Board #%d (at 0x%lx) is out of range (1 <= x <= %d).\n", 147 147 boardno, physloc, MAX_BOARD); 148 148 return 0;