public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sms-cards.c: Ensure index is positive
@ 2009-11-02 16:26 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-11-02 16:26 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

The index is signed, make sure it is not negative
when we read the array element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.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];
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-02 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-02 16:26 [PATCH] sms-cards.c: Ensure index is positive Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox