diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-04-29 11:03:31 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-05-04 11:52:43 +0200 |
commit | 04bf02175fe9577875fb8285cc2d08169fef613a (patch) | |
tree | 9bd4c2b87fa0124f91a29eea7b3dfdb39fd586fb | |
parent | iio: bmi160: Fix ODR setting (diff) | |
download | linux-04bf02175fe9577875fb8285cc2d08169fef613a.tar.xz linux-04bf02175fe9577875fb8285cc2d08169fef613a.zip |
iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
The > here should be >= or we go beyond the end for the array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/iio/dac/ad5592r-base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c index 948f600e7059..69bde5909854 100644 --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c @@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st) device_for_each_child_node(st->dev, child) { ret = fwnode_property_read_u32(child, "reg", ®); - if (ret || reg > ARRAY_SIZE(st->channel_modes)) + if (ret || reg >= ARRAY_SIZE(st->channel_modes)) continue; ret = fwnode_property_read_u32(child, "adi,mode", &tmp); |