diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-12-15 14:50:53 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-12-16 12:29:07 +0000 |
commit | 5d97d9e9a703be2a602ac24c1ba3dae22155a2c8 (patch) | |
tree | 67c2cc63be1641fd80c062fab15ff140d1c8fd7f /drivers/iio/addac/ad74413r.c | |
parent | 0a52c3f347fd0173a6aa718bffedca90816ddac6 (diff) | |
download | linux-stable-5d97d9e9a703be2a602ac24c1ba3dae22155a2c8.tar.gz linux-stable-5d97d9e9a703be2a602ac24c1ba3dae22155a2c8.tar.bz2 linux-stable-5d97d9e9a703be2a602ac24c1ba3dae22155a2c8.zip |
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: fea251b6a5db ("iio: addac: add AD74413R driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/addac/ad74413r.c')
-rw-r--r-- | drivers/iio/addac/ad74413r.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index cbd9aa9b399a..289d254943e1 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -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; } |