summaryrefslogtreecommitdiff
path: root/drivers/iio/dac
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-29 12:03:31 +0300
committerJonathan Cameron <jic23@kernel.org>2016-05-04 12:52:43 +0300
commit04bf02175fe9577875fb8285cc2d08169fef613a (patch)
tree9bd4c2b87fa0124f91a29eea7b3dfdb39fd586fb /drivers/iio/dac
parentc25d3f37be016b301f446a5257645c4845daf53c (diff)
downloadlinux-04bf02175fe9577875fb8285cc2d08169fef613a.tar.xz
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>
Diffstat (limited to 'drivers/iio/dac')
-rw-r--r--drivers/iio/dac/ad5592r-base.c2
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", &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);