lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20250706113525.3996d46b@jic23-huawei> Date: Sun, 6 Jul 2025 11:35:25 +0100 From: Jonathan Cameron <jic23@...nel.org> To: David Lechner <dlechner@...libre.com> Cc: Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich <Michael.Hennerich@...log.com>, Nuno Sá <nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Guillaume Ranquet <granquet@...libre.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH] iio: adc: ad7173: fix channels index for syscalib_mode On Thu, 03 Jul 2025 14:51:17 -0500 David Lechner <dlechner@...libre.com> wrote: > Fix the index used to look up the channel when accessing the > syscalib_mode attribute. The address field is a 0-based index (same > as scan_index) that it used to access the channel in the > ad7173_channels array throughout the driver. The channels field, on > the other hand, may not match the address field depending on the > channel configuration specified in the device tree and could result > in an out-of-bounds access. > > Fixes: 031bdc8aee01 ("iio: adc: ad7173: add calibration support") > Signed-off-by: David Lechner <dlechner@...libre.com> Applied and marked for stable. > --- > drivers/iio/adc/ad7173.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c > index dd9fa35555c79ead5a1b88d1dc6cc3db122502be..03412895f6dc71fcf8a07d09eb9f94a3840f02ef 100644 > --- a/drivers/iio/adc/ad7173.c > +++ b/drivers/iio/adc/ad7173.c > @@ -318,7 +318,7 @@ static int ad7173_set_syscalib_mode(struct iio_dev *indio_dev, > { > struct ad7173_state *st = iio_priv(indio_dev); > > - st->channels[chan->channel].syscalib_mode = mode; > + st->channels[chan->address].syscalib_mode = mode; > > return 0; > } > @@ -328,7 +328,7 @@ static int ad7173_get_syscalib_mode(struct iio_dev *indio_dev, > { > struct ad7173_state *st = iio_priv(indio_dev); > > - return st->channels[chan->channel].syscalib_mode; > + return st->channels[chan->address].syscalib_mode; > } > > static ssize_t ad7173_write_syscalib(struct iio_dev *indio_dev, > @@ -347,7 +347,7 @@ static ssize_t ad7173_write_syscalib(struct iio_dev *indio_dev, > if (!iio_device_claim_direct(indio_dev)) > return -EBUSY; > > - mode = st->channels[chan->channel].syscalib_mode; > + mode = st->channels[chan->address].syscalib_mode; > if (sys_calib) { > if (mode == AD7173_SYSCALIB_ZERO_SCALE) > ret = ad_sd_calibrate(&st->sd, AD7173_MODE_CAL_SYS_ZERO, > > --- > base-commit: 6742eff60460e77158d4f1b233f17e0345c9e66a > change-id: 20250703-iio-adc-ad7173-fix-channels-index-for-syscalib_mode-49b404e99e0c > > Best regards,
Powered by blists - more mailing lists