Re: [PATCH] irqchip/gic-v3: Print a warning for out-of-range interrupt numbers
From: Geert Uytterhoeven
Date: Wed Mar 04 2026 - 12:17:59 EST
Hi Sergey,
On Wed, 4 Mar 2026 at 18:05, Sergey Shtylyov <sergei.shtylyov@xxxxxxxxx> wrote:
> On 3/4/26 7:31 PM, Geert Uytterhoeven wrote:
> > gic_irq_domain_translate() does not check if an interrupt number lies
> > within the valid range of the specified interrupt type. Add these
> > checks, and print a warning if the interrupt number is out of range.
> >
> > This can help flagging incorrectly described Extended SPI and PPI
> > interrupts in DT.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> > ---
> > This would have prevented the issue fixed by "[PATCH] arm64: dts:
> > renesas: r8a78000: Fix out-of-range SPI interrupt numbers"[1].
> >
> > [1] https://lore.kernel.org/1f9dd274720ea1b66617a5dd84f76c3efc829dc8.1772641415.git.geert+renesas@xxxxxxxxx
> > ---
> > drivers/irqchip/irq-gic-v3.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> > index 20f13b686ab22faf..d75163e71bf22473 100644
> > --- a/drivers/irqchip/irq-gic-v3.c
> > +++ b/drivers/irqchip/irq-gic-v3.c
> > @@ -1603,15 +1603,27 @@ static int gic_irq_domain_translate(struct irq_domain *d,
> >
> > switch (fwspec->param[0]) {
> > case 0: /* SPI */
> > + if (fwspec->param[1] > 987)
> > + pr_warn_once("SPI %u out of range (use ESPI?)\n",
> > + fwspec->param[1]);
> > *hwirq = fwspec->param[1] + 32;
> > break;
> > case 1: /* PPI */
> > + if (fwspec->param[1] > 16)
>
> Not 15? Don't PPIs use INTIDs 16-31?
Thank you, that is indeed an off-by-one bug.
Will fix.
>
> > + pr_warn_once("PPI %u out of range (use EPPI?)\n",
> > + fwspec->param[1]);
> > *hwirq = fwspec->param[1] + 16;
> > break;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds