Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1529282
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch] iio: tsl2583: make array large enough |
| Date | 2016-11-24 14:40 +0100 |
| Message-ID | <sH2pP-3mp-27@gated-at.bofh.it> (permalink) |
| References | <sH2pP-3mp-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <dan.carpenter@oracle.com>
diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index 0b87f6a..a78b602 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;
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[patch] iio: tsl2583: make array large enough Dan Carpenter <dan.carpenter@oracle.com> - 2016-11-24 14:40 +0100
Re: [patch] iio: tsl2583: make array large enough Brian Masney <masneyb@onstation.org> - 2016-11-24 16:50 +0100
Re: [patch] iio: tsl2583: make array large enough walter harms <wharms@bfs.de> - 2016-11-24 18:00 +0100
Re: [patch] iio: tsl2583: make array large enough Brian Masney <masneyb@onstation.org> - 2016-11-24 19:00 +0100
Re: [patch] iio: tsl2583: make array large enough Jonathan Cameron <jic23@kernel.org> - 2016-11-24 21:20 +0100
Re: [patch] iio: tsl2583: make array large enough walter harms <wharms@bfs.de> - 2016-11-25 10:00 +0100
csiph-web