]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
iio: dac: ad5592r: Off by one bug in ad5592r_alloc_channels()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 29 Apr 2016 09:03:31 +0000 (12:03 +0300)
committerJonathan Cameron <jic23@kernel.org>
Wed, 4 May 2016 09:52:43 +0000 (10:52 +0100)
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>
drivers/iio/dac/ad5592r-base.c

index 948f600e7059fb8837662a6aa01f3e72a3583100..69bde59098542daf480561c1bb113919736ccb2f 100644 (file)
@@ -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);