From: sashiko-bot@kernel.org
To: "Marcelo Schmitt" <marcelo.schmitt@analog.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v1 11/13] dt-bindings: iio: adc: adi,ad4134: Add high data throughput example
Date: Wed, 02 Sep 2026 17:39:37 +0000 [thread overview]
Message-ID: <20260902173938.55E981F000E9@smtp.kernel.org> (raw)
In-Reply-To: <4044581dcec9854acedb2110acdbc84f6b1713e3.1788368334.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] The newly added device tree example includes 'mux-states' and 'mux-state-names' properties, but these are not defined in the schema, causing schema validation to fail.
Pre-existing issues:
- [High] Out-of-bounds array write in `ad4134_trigger_handler` due to incorrect loop bounds over `masklength`.
- [High] Timestamp push fails with `-ENOSPC` because the buffer size passed to `iio_push_to_buffers_with_ts` is undersized.
--
commit 9db0b7d2cda5447620683544f83d4587b18252b7
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
dt-bindings: iio: adc: adi,ad4134: Add high data throughput example
Add device tree example for AD4134 operation in 4-wire SPI mode with 4
lines to transfer data samples to the host controller.
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
> index 34043f89730b2..6f0b4346426a0 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
[ ... ]
> + clocks = <&sys_clk>;
> + clock-names = "clkin";
> +
> + avdd5-supply = <&avdd5>;
> + dvdd5-supply = <&dvdd5>;
> + iovdd-supply = <&iovdd>;
> + refin-supply = <&refin>;
> + avdd1v8-supply = <&avdd1v8>;
> + dvdd1v8-supply = <&dvdd1v8>;
> + clkvdd-supply = <&clkvdd>;
> +
> + mux-states = <&ad4134_sdo_dout0_mux 0>, <&ad4134_sdo_dout0_mux 1>;
> + mux-state-names = "data_read", "reg_access";
[Severity: Low]
Are the mux-states and mux-state-names properties fully documented in the
schema definition?
The newly added device tree example includes these properties, but they do
not appear to be defined in the schema properties section. Since the schema
uses unevaluatedProperties: false, the example will fail schema validation
during a dt_binding_check.
> +
> + adi,spi-mode = "4-wire";
> + };
> + };
> ...
While reviewing this series, I also noticed a couple of pre-existing issues
in the driver implementation:
drivers/iio/adc/ad4134.c:ad4134_trigger_handler()
{
[ ... ]
for (unsigned int ch = 0; ch < iio_get_masklength(indio_dev); ch++) {
ret = spi_write_then_read(st->spi, NULL, 0, &st->scan[ch],
BITS_TO_BYTES(AD4134_CHAN_PRECISION_BITS));
[ ... ]
[Severity: High]
This is a pre-existing issue, but does this loop overflow the st->scan array
when the soft timestamp channel is enabled?
The loop unconditionally iterates up to iio_get_masklength(indio_dev).
Because the soft timestamp channel is registered with scan_index = 4, the
mask length evaluates to 5 whenever the timestamp is enabled.
Since st->scan is an array of size 4, when ch evaluates to 4,
spi_write_then_read() will write 3 bytes out-of-bounds to &st->scan[4],
corrupting adjacent memory.
[ ... ]
iio_push_to_buffers_with_ts(indio_dev, &st->scan, sizeof(st->scan),
pf->timestamp);
[ ... ]
[Severity: High]
This is a pre-existing issue, but will the statically sized length passed
here cause iio_push_to_buffers_with_ts() to fail with -ENOSPC?
The iio_push_to_buffers_with_ts() function requires the buffer size argument
to be at least indio_dev->scan_bytes to accommodate all active channels plus
the 8-byte timestamp.
The driver statically passes sizeof(st->scan), which is 16 bytes. When 3 or 4
channels plus the timestamp are active, the required size expands to 24 bytes
(16 bytes of data + 8 bytes timestamp). This will cause the push to abort,
resulting in lost samples.
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788368334.git.marcelo.schmitt@analog.com?part=11
next prev parent reply other threads:[~2026-09-02 17:39 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 17:21 [PATCH v1 00/13] iio: adc: ad4134: Enable greater sample rate data capture Marcelo Schmitt
2026-09-02 17:21 ` [PATCH v1 01/13] iio: Fix typo in vendor name Marcelo Schmitt
2026-09-03 6:22 ` Andy Shevchenko
2026-09-04 19:41 ` Marcelo Schmitt
2026-09-05 7:40 ` Andy Shevchenko
2026-09-05 7:41 ` Andy Shevchenko
2026-09-02 17:21 ` [PATCH v1 02/13] iio: adc: ad4134: Drop import to empty name space Marcelo Schmitt
2026-09-02 17:22 ` [PATCH v1 03/13] iio: adc: ad4134: Update include list to comply with IWYU principles Marcelo Schmitt
2026-09-02 17:40 ` sashiko-bot
2026-09-03 6:26 ` Andy Shevchenko
2026-09-02 17:22 ` [PATCH v1 04/13] iio: adc: ad4134: Serialize single-read operations Marcelo Schmitt
2026-09-03 6:27 ` Andy Shevchenko
2026-09-06 18:50 ` Jonathan Cameron
2026-09-02 17:23 ` [PATCH v1 05/13] iio: adc: ad4134: Run shorter transfers when CRC is disabled Marcelo Schmitt
2026-09-02 17:42 ` sashiko-bot
2026-09-02 17:23 ` [PATCH v1 06/13] iio: adc: ad4134: Add support for digital filter type selection Marcelo Schmitt
2026-09-03 6:31 ` Andy Shevchenko
2026-09-02 17:23 ` [PATCH v1 07/13] iio: adc: ad4134: Support buffered data read Marcelo Schmitt
2026-09-02 17:38 ` sashiko-bot
2026-09-02 17:24 ` [PATCH v1 08/13] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode Marcelo Schmitt
2026-09-02 17:46 ` sashiko-bot
2026-09-03 18:14 ` Conor Dooley
2026-09-04 20:47 ` Marcelo Schmitt
2026-09-04 22:06 ` Marcelo Schmitt
2026-09-06 19:26 ` Jonathan Cameron
2026-09-09 15:17 ` Marcelo Schmitt
2026-09-07 17:52 ` Conor Dooley
2026-09-10 22:19 ` Marcelo Schmitt
2026-09-06 19:15 ` Jonathan Cameron
2026-09-02 17:24 ` [PATCH v1 09/13] iio: adc: ad4134: Support SPI 4-wire mode Marcelo Schmitt
2026-09-02 17:46 ` sashiko-bot
2026-09-03 6:39 ` Andy Shevchenko
2026-09-02 17:24 ` [PATCH v1 10/13] dt-bindings: iio: adc: adi,ad4134: Document PWM usage Marcelo Schmitt
2026-09-04 15:53 ` Conor Dooley
2026-09-02 17:25 ` [PATCH v1 11/13] dt-bindings: iio: adc: adi,ad4134: Add high data throughput example Marcelo Schmitt
2026-09-02 17:39 ` sashiko-bot [this message]
2026-09-02 17:25 ` [PATCH v1 12/13] iio: adc: ad4134: Support high-speed data capture Marcelo Schmitt
2026-09-02 17:49 ` sashiko-bot
2026-09-03 7:00 ` Andy Shevchenko
2026-09-02 17:25 ` [PATCH v1 13/13] Docs: iio: Add AD4134 Marcelo Schmitt
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=20260902173938.55E981F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.