From: sashiko-bot@kernel.org
To: "Radu Sabau via B4 Relay" <devnull+radu.sabau.analog.com@kernel.org>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v14 5/6] iio: adc: ad4691: add oversampling support
Date: Fri, 29 May 2026 13:23:06 +0000 [thread overview]
Message-ID: <20260529132306.BD1791F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260529-ad4692-multichannel-sar-adc-driver-v14-5-e93c2747dc1f@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Out-of-bounds array access in SPI transfer setup when the soft timestamp channel is enabled.
--
commit 432eefa94b45dd8bef36e14221d32f97f7de44ee
Author: Radu Sabau <radu.sabau@analog.com>
Subject: iio: adc: ad4691: add oversampling support
This commit adds oversampling ratio (OSR) support for CNV burst mode and
introduces manual mode channels that omit the OSR attribute. It also manages
shared internal oscillator frequencies based on OSR.
> diff --git a/drivers/iio/adc/ad4691.c b/drivers/iio/adc/ad4691.c
> index b1d1b42f724e7..043143ae95608 100644
> --- a/drivers/iio/adc/ad4691.c
> +++ b/drivers/iio/adc/ad4691.c
[ ... ]
> @@ -241,23 +294,91 @@ static const struct iio_chan_spec ad4693_offload_channels[] = {
> AD4691_OFFLOAD_CHANNEL(7),
> };
>
> +static const struct iio_chan_spec ad4691_manual_channels[] = {
> + AD4691_MANUAL_CHANNEL(0),
[ ... ]
> + AD4691_MANUAL_CHANNEL(14),
> + AD4691_MANUAL_CHANNEL(15),
> + IIO_CHAN_SOFT_TIMESTAMP(16),
> +};
[Severity: High]
When the timestamp channel is enabled via sysfs, will this result in 17 active
channels in the scan mask?
If so, when iterating over the active channels in functions like
ad4691_cnv_burst_buffer_preenable() and
ad4691_cnv_burst_offload_buffer_postenable():
k = 0;
iio_for_each_active_channel(indio_dev, i) {
put_unaligned_be16(0x8000 | AD4691_AVG_IN(i), &st->scan_tx[k]);
...
k++;
}
...
st->scan_xfers[2 * k].tx_buf = st->scan_tx_reset;
Does k reach 17 after the loop, causing an out-of-bounds access to
st->scan_xfers[34] when setting up the reset transfer, and a similar
out-of-bounds access to st->scan_tx[17] in the manual mode path? The
st->scan_xfers array is sized at 34 and st->scan_tx at 17, making indices 34
and 17 out of bounds.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260529-ad4692-multichannel-sar-adc-driver-v14-0-e93c2747dc1f@analog.com?part=5
next prev parent reply other threads:[~2026-05-29 13:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 10:14 [PATCH v14 0/6] iio: adc: ad4691: add driver for AD4691 multichannel SAR ADC family Radu Sabau via B4 Relay
2026-05-29 10:15 ` [PATCH v14 1/6] dt-bindings: iio: adc: add AD4691 family Radu Sabau via B4 Relay
2026-05-29 10:22 ` sashiko-bot
2026-05-29 10:15 ` [PATCH v14 2/6] iio: adc: ad4691: add initial driver for " Radu Sabau via B4 Relay
2026-05-29 10:15 ` [PATCH v14 3/6] iio: adc: ad4691: add triggered buffer support Radu Sabau via B4 Relay
2026-05-29 11:48 ` sashiko-bot
2026-05-29 10:15 ` [PATCH v14 4/6] iio: adc: ad4691: add SPI offload support Radu Sabau via B4 Relay
2026-05-29 10:15 ` [PATCH v14 5/6] iio: adc: ad4691: add oversampling support Radu Sabau via B4 Relay
2026-05-29 13:23 ` sashiko-bot [this message]
2026-05-29 10:15 ` [PATCH v14 6/6] docs: iio: adc: ad4691: add driver documentation Radu Sabau via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260529132306.BD1791F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+radu.sabau.analog.com@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox