linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] iio: tsl2583: off by one in in_illuminance_lux_table_store()
@ 2016-11-18 11:51 Dan Carpenter
  2016-11-18 14:03 ` Brian Masney
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2016-11-18 11:51 UTC (permalink / raw)
  To: Jonathan Cameron, Jon Brenner
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Brian Masney, Greg Kroah-Hartman, Eva Rachel Retuya, linux-iio,
	kernel-janitors

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 <dan.carpenter@oracle.com>

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);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-11-25  8:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18 11:51 [patch] iio: tsl2583: off by one in in_illuminance_lux_table_store() Dan Carpenter
2016-11-18 14:03 ` Brian Masney
2016-11-24 13:38   ` [patch] iio: tsl2583: make array large enough Dan Carpenter
2016-11-24 15:48     ` Brian Masney
2016-11-24 16:54       ` walter harms
2016-11-24 17:51         ` Brian Masney
2016-11-24 20:12           ` Jonathan Cameron
2016-11-25  8:53           ` walter harms

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).