iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config()
PATCH 1/1 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.
---
Obligatory grumble: When you merge a new driver please use a patch prefix based on what the driver will use.
Bad: [SUBJECT] subsystem: add new driver for XYZ123
Good: [SUBJECT] subsystem/xyz123: add new driver for XYZ123
Same rule for adding subdirectories. That way no one (me) has to guess.
drivers/iio/addac/ad74413r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/addac/ad74413r.c +1 -1
@@ -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 ; }
Signature · 1 line
2.20.1
Quoted 45 lines
-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Wednesday, December 15, 2021 1:51 PM
To: Tanislav, Cosmin <[email protected]>
Cc: Hennerich, Michael <[email protected]>; Jonathan Cameron <[email protected]>; Linus Walleij <[email protected]>; linux- [email protected]; [email protected]
Subject: [PATCH] iio: addac: ad74413r: fix off by one inad74413r_parse_channel_config()[External]
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 <[email protected]>---
Obligatory grumble: When you merge a new driver please use a patch prefix based on what the driver will use.Bad: [SUBJECT] subsystem: add new driver for XYZ123
Good: [SUBJECT] subsystem/xyz123: add new driver for XYZ123Same rule for adding subdirectories. That way no one (me) has to guess.
drivers/iio/addac/ad74413r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/addac/ad74413r.c +1
-1@@ -1150,7 +1150,7 @@ static int ad74413r_parse_channel_config(structiio_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 ;}
--
2.20.1
Jonathan Cameron
AppliedQuoted 1 line · Cosmin
Reviewed-by Cosmin Tanislav <[email protected]>
Applied, thanks,
Jonathan
Quoted 47 lines
Quoted 46 lines
-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Wednesday, December 15, 2021 1:51 PM
To: Tanislav, Cosmin <[email protected]>
Cc: Hennerich, Michael <[email protected]>; Jonathan Cameron <[email protected]>; Linus Walleij <[email protected]>; linux- [email protected]; [email protected]
Subject: [PATCH] iio: addac: ad74413r: fix off by one inad74413r_parse_channel_config()[External]
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 <[email protected]>---
Obligatory grumble: When you merge a new driver please use a patch prefix based on what the driver will use.Bad: [SUBJECT] subsystem: add new driver for XYZ123
Good: [SUBJECT] subsystem/xyz123: add new driver for XYZ123Same rule for adding subdirectories. That way no one (me) has to guess.
drivers/iio/addac/ad74413r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/addac/ad74413r.c +1
-1@@ -1150,7 +1150,7 @@ static int ad74413r_parse_channel_config(structiio_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 ;}
--
2.20.1