From: sashiko-bot@kernel.org
To: "Biju Das" <biju.das.jz@bp.renesas.com>
Cc: robh@kernel.org, wsa+renesas@sang-engineering.com,
conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 7/8] iio: adc: rzg2l_adc: Add RZ/G3L ADC support for TSU
Date: Tue, 22 Sep 2026 04:41:52 +0000 [thread overview]
Message-ID: <20260922044152.D2BCA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922042707.116378-8-biju.das.jz@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] iio: adc: rzg2l_adc: missing channel validation for RZ/G3L ADC1 causes state leaks and potential crashes
--
commit 6a30a731629fb5bab54f976d5c01c9fd5c2d8432
Author: Biju Das <biju.das.jz@bp.renesas.com>
iio: adc: rzg2l_adc: Add RZ/G3L ADC support for TSU
Add renesas,r9a08g046-adc1 compatible string and its hardware
parameters for the ADC1 IP on RZ/G3L, which is dedicated to
the on-chip TSU (thermal sensor unit).
> diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
> index aaf7e2ceff8ab..c892e355b7398 100644
> --- a/drivers/iio/adc/rzg2l_adc.c
> +++ b/drivers/iio/adc/rzg2l_adc.c
> @@ -500,8 +500,17 @@ static const struct rzg2l_adc_hw_params rzg3s_hw_params = {
> .adint_inten_mask = GENMASK(11, 0),
> };
>
> +static const struct rzg2l_adc_hw_params rzg3l_adc1_hw_params = {
> + .max_channels = 9,
> + .default_adcmp = 0x1d,
> + .default_adsmp = { 0x7f, 0xff },
> + .adsmp_mask = GENMASK(7, 0),
> + .adint_inten_mask = BIT(8),
[Severity: High]
Does this mask inadvertently leak the interrupt enable state for channels 0-7 if
they are incorrectly configured in the device tree?
With max_channels set to 9, rzg2l_adc_probe() accepts channels 0 through 8 from
the device tree. If an unsupported channel (e.g., 0) is probed and accessed via
sysfs, rzg2l_adc_conversion_setup() sets BIT(0) in the interrupt enable
register.
However, because adint_inten_mask is restricted to BIT(8), the driver's timeout
and cleanup paths will fail to clear BIT(0):
drivers/iio/adc/rzg2l_adc.c:rzg2l_adc_conversion() {
...
rzg2l_adc_writel(adc, RZG2L_ADINT,
rzg2l_adc_readl(adc, RZG2L_ADINT) & ~hw_params->adint_inten_mask);
...
}
Additionally, reading an unsupported channel data register in the ISR could
cause a synchronous external abort:
drivers/iio/adc/rzg2l_adc.c:rzg2l_adc_isr() {
...
for_each_set_bit(ch, &intst, hw_params->max_channels)
adc->last_val[ch] = rzg2l_adc_readl(adc, RZG2L_ADCR(ch)) & RZG2L_ADCR_AD_MASK;
...
}
> +};
> +
> static const struct of_device_id rzg2l_adc_match[] = {
> { .compatible = "renesas,r9a08g045-adc", .data = &rzg3s_hw_params },
> + { .compatible = "renesas,r9a08g046-adc1", .data = &rzg3l_adc1_hw_params },
> { .compatible = "renesas,rzg2l-adc", .data = &rzg2l_hw_params },
> { }
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922042707.116378-1-biju.das.jz@bp.renesas.com?part=7
next prev parent reply other threads:[~2026-09-22 4:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 4:26 [PATCH v3 0/8] Add Renesas RZ/G3L TSU support Biju Das
2026-09-22 4:26 ` [PATCH v3 2/8] dt-bindings: thermal: r9a08g045-tsu: Document RZ/G3L TSU Biju Das
2026-09-22 4:26 ` [PATCH v3 5/8] dt-bindings: iio: adc: renesas,rzg2l-adc: Document RZ/G3L ADC for TSU Biju Das
2026-09-28 6:05 ` Krzysztof Kozlowski
2026-09-28 6:25 ` Biju Das
2026-09-28 6:27 ` Krzysztof Kozlowski
2026-09-28 6:32 ` Biju Das
2026-09-28 7:53 ` Krzysztof Kozlowski
2026-09-22 4:26 ` [PATCH v3 6/8] iio: adc: rzg2l_adc: Rename num_channels to max_channels Biju Das
2026-09-22 14:33 ` Geert Uytterhoeven
2026-09-23 8:21 ` Biju Das
2026-09-25 2:55 ` Jonathan Cameron
2026-09-25 3:55 ` Biju Das
2026-09-27 18:06 ` Jonathan Cameron
2026-09-22 4:26 ` [PATCH v3 7/8] iio: adc: rzg2l_adc: Add RZ/G3L ADC support for TSU Biju Das
2026-09-22 4:41 ` sashiko-bot [this message]
2026-09-22 5:47 ` Biju Das
2026-09-22 4:27 ` [PATCH v3 8/8] arm64: dts: renesas: r9a08g046: Enable TSU Biju Das
2026-09-22 4:44 ` sashiko-bot
2026-09-22 5:07 ` Biju Das
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=20260922044152.D2BCA1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=biju.das.jz@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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