Commit 5d97d9e9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron

iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config()

The > needs to be >= to prevent accessing one element beyond the end of
the st->channel_configs[] array.

Fixes: fea251b6 ("iio: addac: add AD74413R driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarCosmin Tanislav <cosmin.tanislav@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 0a52c3f3
......@@ -1150,7 +1150,7 @@ static int ad74413r_parse_channel_config(struct iio_dev *indio_dev,
return ret;
}
if (index > AD74413R_CHANNEL_MAX) {
if (index >= AD74413R_CHANNEL_MAX) {
dev_err(st->dev, "Channel index %u is too large\n", index);
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment