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

From: Roel Kluin
Date: Mon Nov 02 2009 - 11:15:41 EST


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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/