[PATCH] sms-cards.c: Ensure index is positive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
 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-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux