Skip to contentSkip to conversation

sms-cards.c: Ensure index is positive

PATCH New Roel Kluin 1 participant 1 message Nov 2, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 sms-cards.c: Ensure index is positive

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

---
 drivers/media/dvb/siano/sms-cards.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/dvb/siano/sms-cards.c +1 -1
index 0420e28..52f0dac 100644
@@ -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];
 }