From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 18 Nov 2016 11:51:54 +0000 Subject: [patch] iio: tsl2583: off by one in in_illuminance_lux_table_store() Message-Id: <20161118115153.GC3281@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jonathan Cameron , Jon Brenner Cc: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Brian Masney , Greg Kroah-Hartman , Eva Rachel Retuya , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org The value[] array has "max_ints" elements so this should be >= instead of >. Fixes: ac4f6eee8fe8 ("staging: iio: TAOS tsl258x: Device driver") Signed-off-by: Dan Carpenter diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c index 0b87f6a..faef6bd 100644 --- a/drivers/iio/light/tsl2583.c +++ b/drivers/iio/light/tsl2583.c @@ -580,7 +580,7 @@ static ssize_t in_illuminance_lux_table_store(struct device *dev, * and the last table entry is all 0. */ n = value[0]; - if ((n % 3) || n < 6 || n > max_ints) { + if ((n % 3) || n < 6 || n >= max_ints) { dev_err(dev, "%s: The number of entries in the lux table must be a multiple of 3 and within the range [6, %d]\n", __func__, max_ints);