[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r11xbxox.wl-maz@kernel.org>
Date: Wed, 03 Aug 2022 08:20:14 +0100
From: Marc Zyngier <maz@...nel.org>
To: Huacai Chen <chenhuacai@...ngson.cn>
Cc: Thomas Gleixner <tglx@...utronix.de>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>,
Huacai Chen <chenhuacai@...il.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: Re: [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow
On Wed, 03 Aug 2022 05:27:27 +0100,
Huacai Chen <chenhuacai@...ngson.cn> wrote:
>
> Check hwirq overflow when allocate irq in eiointc domain.
>
> Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> ---
> drivers/irqchip/irq-loongson-eiointc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
> index 80d8ca6f2d46..f8060e58ee06 100644
> --- a/drivers/irqchip/irq-loongson-eiointc.c
> +++ b/drivers/irqchip/irq-loongson-eiointc.c
> @@ -241,8 +241,11 @@ static int eiointc_domain_alloc(struct irq_domain *domain, unsigned int virq,
> struct eiointc *priv = domain->host_data;
>
> ret = irq_domain_translate_onecell(domain, arg, &hwirq, &type);
> - if (ret)
> - return ret;
> + if (ret < 0)
> + return -EINVAL;
> +
> + if (hwirq >= IOCSR_EXTIOI_VECTOR_NUM)
> + return -EINVAL;
How can this happen? Also, you're allocating a *range*. Surely the
upper boundary should matter too?
And for the umpteenth time, please add a cover letter when sending
multiple patches. This is a hard requirement for me.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists