From: sashiko-bot@kernel.org
To: "Andre Przywara" <andre.przywara@arm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 6/7] pinctrl: sunxi: a523-r: add a733-r compatible string
Date: Thu, 10 Sep 2026 14:15:58 +0000 [thread overview]
Message-ID: <20260910141559.53BB91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910133519.459011-7-andre.przywara@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the static `desc->npins` counter accumulates on probe deferral, causing out-of-bounds array reads with negative indices.
--
commit 0f0363ee56222ed4bd5f82e32e391a15a8e11f99
Author: Andre Przywara <andre.przywara@arm.com>
pinctrl: sunxi: a523-r: add a733-r compatible string
Adds the allwinner,sun60i-a733-r-pinctrl compatible string to the A523-r
pinctrl driver. The driver is reused for the A733-r IP since it shares a
similar two-bank layout, with specific pinmux values provided by the DT.
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> index 9e07fbb5be7cb..dfdcfa740ecc9 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
> @@ -40,6 +40,7 @@ static int a523_r_pinctrl_probe(struct platform_device *pdev)
>
> static const struct of_device_id a523_r_pinctrl_match[] = {
> { .compatible = "allwinner,sun55i-a523-r-pinctrl", },
> + { .compatible = "allwinner,sun60i-a733-r-pinctrl", },
[Severity: High]
This isn't a bug introduced by this patch, but does the static desc->npins
counter accumulate on probe deferral, causing out-of-bounds array reads with
negative indices?
When the driver is probed, it passes the statically allocated
a523_r_pinctrl_data to sunxi_pinctrl_dt_table_init().
In drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c:init_pins_table():
for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) {
desc->npins += pins_per_bank[i];
If the probe fails later (e.g., -EPROBE_DEFER), desc->npins is not reset.
On the next probe, it increments again, allocating a larger array but only
initializing the first valid elements.
Then prepare_function_table() iterates up to the accumulated desc->npins:
for (i = 0; i < npins; i++) {
struct sunxi_desc_pin *pin = &pins[i];
int bank = (pin->pin.number - pin_base) / PINS_PER_BANK;
if (irq_bank_muxes[bank]) {
For uninitialized pins, pin->pin.number is 0. With a pin_base like 352
(PL_BASE), the bank index becomes (0 - 352) / 32 = -11. This results
in an out-of-bounds access irq_bank_muxes[-11].
Furthermore, searching for a non-existent DT pin name will scan into the
uninitialized elements, calling strcmp(NULL, name) and potentially panicking
the kernel.
> {}
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910133519.459011-1-andre.przywara@arm.com?part=6
next prev parent reply other threads:[~2026-09-10 14:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 13:35 [PATCH 0/7] pinctrl: sunxi: Add Allwinner A733 support Andre Przywara
2026-09-10 13:35 ` [PATCH 1/7] pinctrl: sunxi: rename SUNXI_PINCTRL_NEW_REG_LAYOUT Andre Przywara
2026-09-10 13:35 ` [PATCH 2/7] pinctrl: sunxi: only use PortK special handling on A523 Andre Przywara
2026-09-10 14:56 ` Chen-Yu Tsai
2026-09-10 13:35 ` [PATCH 3/7] pinctrl: sunxi: refactor IRQ register accessors Andre Przywara
2026-09-10 13:35 ` [PATCH 4/7] pinctrl: sunxi: support A733 generation MMIO register layout Andre Przywara
2026-09-10 14:05 ` sashiko-bot
2026-09-10 13:35 ` [PATCH 5/7] dt-bindings: pinctrl: add compatible for Allwinner A733 Andre Przywara
2026-09-10 13:35 ` [PATCH 6/7] pinctrl: sunxi: a523-r: add a733-r compatible string Andre Przywara
2026-09-10 14:15 ` sashiko-bot [this message]
2026-09-10 13:35 ` [PATCH 7/7] pinctrl: sunxi: add support for the Allwinner A733 Andre Przywara
2026-09-10 14:30 ` sashiko-bot
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=20260910141559.53BB91F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andre.przywara@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--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.