From: Dan Carpenter Date: Thu, 24 Nov 2016 13:38:07 +0000 (+0300) Subject: iio: tsl2583: make array large enough X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0e8d2b0f74c07e68d6fa6ea3113de5735d59d018;p=linux-beck.git iio: tsl2583: make array large enough This array is supposed to have 10 elements. Smatch complains that with the current code we can have n == max_ints and read beyond the end of the array. Fixes: ac4f6eee8fe8 ("staging: iio: TAOS tsl258x: Device driver") Signed-off-by: Dan Carpenter Acked-by: Brian Masney Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c index 0b87f6adbb79..a78b6025c465 100644 --- a/drivers/iio/light/tsl2583.c +++ b/drivers/iio/light/tsl2583.c @@ -565,7 +565,7 @@ static ssize_t in_illuminance_lux_table_store(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); const unsigned int max_ints = TSL2583_MAX_LUX_TABLE_ENTRIES * 3; - int value[TSL2583_MAX_LUX_TABLE_ENTRIES * 3]; + int value[TSL2583_MAX_LUX_TABLE_ENTRIES * 3 + 1]; int ret = -EINVAL; unsigned int n;