mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Huacai Chen <chenhuacai@gmail.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow
Date: Wed, 03 Aug 2022 08:20:14 +0100	[thread overview]
Message-ID: <87r11xbxox.wl-maz@kernel.org> (raw)
In-Reply-To: <20220803042728.3230346-1-chenhuacai@loongson.cn>

On Wed, 03 Aug 2022 05:27:27 +0100,
Huacai Chen <chenhuacai@loongson.cn> wrote:
> 
> Check hwirq overflow when allocate irq in eiointc domain.
> 
> Signed-off-by: Huacai Chen <chenhuacai@loongson.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.

  parent reply	other threads:[~2022-08-03  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  4:27 Huacai Chen
2022-08-03  4:27 ` [PATCH 2/2] irqchip/loongson-eiointc: Fix irq affinity setting Huacai Chen
2022-08-03  7:20 ` Marc Zyngier [this message]
2022-08-03  7:33   ` [PATCH 1/2] irqchip/loongson-eiointc: Check hwirq overflow Huacai Chen
2022-08-03 11:58     ` Jianmin Lv
2022-08-04  2:46       ` Huacai Chen

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=87r11xbxox.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®