[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-2-57fef8c7a3fd@baylibre.com>
Date: Tue, 18 Feb 2025 17:17:46 -0600
From: David Lechner <dlechner@...libre.com>
To: Michael Hennerich <michael.hennerich@...log.com>,
Nuno Sá <nuno.sa@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>, Jonathan Cameron <jic23@...nel.org>,
Trevor Gamblin <tgamblin@...libre.com>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
David Lechner <dlechner@...libre.com>
Subject: [PATCH 2/2] iio: adc: ad4695: simplify getting oversampling_ratio
We already have a local variable that holds a pointer to
st->channels_cfg[chan->scan_index]. Use that to simplify the code.
Signed-off-by: David Lechner <dlechner@...libre.com>
---
drivers/iio/adc/ad4695.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad4695.c b/drivers/iio/adc/ad4695.c
index 8721cbd2af34c53f0cea32e307b9ef2da46b0cfb..b38d2b3ccbfca10dfe5b05c3a96ba00f8838b89c 100644
--- a/drivers/iio/adc/ad4695.c
+++ b/drivers/iio/adc/ad4695.c
@@ -1164,7 +1164,7 @@ static int ad4695_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
switch (chan->type) {
case IIO_VOLTAGE:
- *val = st->channels_cfg[chan->scan_index].oversampling_ratio;
+ *val = cfg->oversampling_ratio;
return IIO_VAL_INT;
default:
return -EINVAL;
--
2.43.0
Powered by blists - more mailing lists