Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Caleb James DeLisle" <cjd@cjdns.fr>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/2] mips: dts: econet: Describe dual-VPE 34Kc processor
Date: Tue, 28 Jul 2026 19:09:33 +0000	[thread overview]
Message-ID: <20260728190934.630AE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728184959.102441-3-cjd@cjdns.fr>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Off-by-one array bounds check in `get_shadow_interrupts()` allows out-of-bounds write.
- [High] Bitwise shift overflow and incorrect register targeting when unmasking CPU interrupts >= 32 in `econet_cpu_init()`.
--

--- Patch [2]: [PATCH 2/2] mips: dts: econet: Describe dual-VPE 34Kc processor ---
commit 2334c8459979130dce8cf68994de6842f0bba377
Author: Caleb James DeLisle <cjd@cjdns.fr>

mips: dts: econet: Describe dual-VPE 34Kc processor
    
The 34Kc processor has two VPEs (threads) and the interrupt controller
on the EN751221 re-routes (in hardware) the software interrupt pins
zero and one to numbers 7 and 8 in the flat VEIC interrupt domain.

> diff --git a/arch/mips/boot/dts/econet/en751221.dtsi b/arch/mips/boot/dts/econet/en751221.dtsi
> index 72cb65654c341..57ae84a8a9f85 100644
> --- a/arch/mips/boot/dts/econet/en751221.dtsi
> +++ b/arch/mips/boot/dts/econet/en751221.dtsi

[ ... ]

> @@ -65,6 +71,7 @@ intc: interrupt-controller@1fb40000 {
>  		interrupt-controller;
>  		#interrupt-cells = <1>;
>  		econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>;

[Severity: High]
This isn't a bug introduced by this patch, but is there an off-by-one array
bounds check in the driver that parses this property?

Looking at get_shadow_interrupts() in drivers/irqchip/irq-econet-en751221.c,
the bounds check uses > instead of >=:

    if (shadow > IRQ_COUNT) {
        ...

If a device tree supplies a shadow interrupt number of 40 (which equals
IRQ_COUNT), this check evaluates to false. This allows an out-of-bounds
write of one byte past the end of the econet_intc struct:

    econet_intc.interrupt_shadows[shadow] = IS_SHADOW;

Could this lead to adjacent memory corruption if malformed device tree data
is parsed?

> +		econet,cpu-interrupt-map = <7 0>, <8 1>;

[Severity: High]
This is a pre-existing issue, but does parsing this property expose a bitwise
shift overflow and incorrect register targeting in the driver if receive
IRQs >= 32 are provided?

In drivers/irqchip/irq-econet-en751221.c:econet_cpu_init(), the code validates
input up to IRQ_COUNT - 1 (39), but unconditionally applies BIT(receive) to a
32-bit mask:

    mask |= BIT(receive);

It then writes this to REG_MASK0, which is only for IRQs 0-31, ignoring
REG_MASK1:

    econet_wreg(REG_MASK0, mask, mask);

Since the driver explicitly validates input up to 39, could providing a device
tree with receive IRQs >= 32 trigger undefined behavior and functional failures?

>  	};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728184959.102441-1-cjd@cjdns.fr?part=2

      reply	other threads:[~2026-07-28 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 18:49 [PATCH 0/2] mips: econet: add multi-vpe capability to EN751221 Caleb James DeLisle
2026-07-28 18:49 ` [PATCH 1/2] " Caleb James DeLisle
2026-07-28 19:06   ` sashiko-bot
2026-07-28 19:36     ` Caleb James DeLisle
2026-07-28 18:49 ` [PATCH 2/2] mips: dts: econet: Describe dual-VPE 34Kc processor Caleb James DeLisle
2026-07-28 19:09   ` sashiko-bot [this message]

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=20260728190934.630AE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cjd@cjdns.fr \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.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