Commit 04bf0217 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent c25d3f37
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);