[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4AEF0837.8080503@gmail.com>
Date:	Mon, 02 Nov 2009 17:26:31 +0100
From:	Roel Kluin <roel.kluin@...il.com>
To:	Mauro Carvalho Chehab <mchehab@...radead.org>,
	linux-media@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] sms-cards.c: Ensure index is positive
The index is signed, make sure it is not negative
when we read the array element.
Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
 drivers/media/dvb/siano/sms-cards.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
index 0420e28..52f0dac 100644
--- a/drivers/media/dvb/siano/sms-cards.c
+++ b/drivers/media/dvb/siano/sms-cards.c
@@ -99,7 +99,7 @@ static struct sms_board sms_boards[] = {
 
 struct sms_board *sms_get_board(int id)
 {
-	BUG_ON(id >= ARRAY_SIZE(sms_boards));
+	BUG_ON(id >= ARRAY_SIZE(sms_boards) || id < 0);
 
 	return &sms_boards[id];
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
