From: Eric Sesterhenn Date: Tue, 11 Apr 2006 05:54:36 +0000 (-0700) Subject: [PATCH] Wrong out of range check in drivers/char/applicom.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e60b6e2f747e94358fed9a23afd6abd738de4bf7;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 927a5bbe112..a370e7a0bad 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -142,7 +142,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc, 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;