All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Guanrui Huang <guanrui.huang@linux.alibaba.com>
Cc: yuzenghui@huawei.com, shannon.zhao@linux.alibaba.com,
	tglx@linutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] irqchip/gic-v3-its: remove BUG_ON in its_vpe_irq_domain_alloc
Date: Sat, 13 Apr 2024 09:44:13 +0100	[thread overview]
Message-ID: <878r1hslcy.wl-maz@kernel.org> (raw)
In-Reply-To: <20240413064051.31315-2-guanrui.huang@linux.alibaba.com>

On Sat, 13 Apr 2024 07:40:51 +0100,
Guanrui Huang <guanrui.huang@linux.alibaba.com> wrote:
> 
> If vm is NULL in here, that means caller has a bug.
> BUG_ON in here is useless, this will paper over bug.

This BUG_ON() doesn't paper over a bug like your previous patch
did. It catches a bug (vm should never be NULL), but also forces the
system to crash for no good reason.

The same effect will be obtained by letting the code run its course
and vm being dereferenced, triggering an exception.

> 
> So just remove this check.
> 
> Signed-off-by: Guanrui Huang <guanrui.huang@linux.alibaba.com>
> ---
>  drivers/irqchip/irq-gic-v3-its.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 2305f6b524a9..55c83e19719d 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -4521,8 +4521,6 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
>  	struct page *vprop_page;
>  	int base, nr_ids, i, err = 0;
>  
> -	BUG_ON(!vm);
> -
>  	bitmap = its_lpi_alloc(roundup_pow_of_two(nr_irqs), &base, &nr_ids);
>  	if (!bitmap)
>  		return -ENOMEM;

With the commit message fixed:

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Guanrui Huang <guanrui.huang@linux.alibaba.com>
Cc: yuzenghui@huawei.com, shannon.zhao@linux.alibaba.com,
	tglx@linutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] irqchip/gic-v3-its: remove BUG_ON in its_vpe_irq_domain_alloc
Date: Sat, 13 Apr 2024 09:44:13 +0100	[thread overview]
Message-ID: <878r1hslcy.wl-maz@kernel.org> (raw)
In-Reply-To: <20240413064051.31315-2-guanrui.huang@linux.alibaba.com>

On Sat, 13 Apr 2024 07:40:51 +0100,
Guanrui Huang <guanrui.huang@linux.alibaba.com> wrote:
> 
> If vm is NULL in here, that means caller has a bug.
> BUG_ON in here is useless, this will paper over bug.

This BUG_ON() doesn't paper over a bug like your previous patch
did. It catches a bug (vm should never be NULL), but also forces the
system to crash for no good reason.

The same effect will be obtained by letting the code run its course
and vm being dereferenced, triggering an exception.

> 
> So just remove this check.
> 
> Signed-off-by: Guanrui Huang <guanrui.huang@linux.alibaba.com>
> ---
>  drivers/irqchip/irq-gic-v3-its.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 2305f6b524a9..55c83e19719d 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -4521,8 +4521,6 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
>  	struct page *vprop_page;
>  	int base, nr_ids, i, err = 0;
>  
> -	BUG_ON(!vm);
> -
>  	bitmap = its_lpi_alloc(roundup_pow_of_two(nr_irqs), &base, &nr_ids);
>  	if (!bitmap)
>  		return -ENOMEM;

With the commit message fixed:

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2024-04-13  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  6:40 [PATCH v4 1/2] irqchip/gic-v3-its: Fix double free on error Guanrui Huang
2024-04-13  6:40 ` Guanrui Huang
2024-04-13  6:40 ` [PATCH v4 2/2] irqchip/gic-v3-its: remove BUG_ON in its_vpe_irq_domain_alloc Guanrui Huang
2024-04-13  6:40   ` Guanrui Huang
2024-04-13  8:44   ` Marc Zyngier [this message]
2024-04-13  8:44     ` Marc Zyngier
2024-04-13  8:44 ` [PATCH v4 1/2] irqchip/gic-v3-its: Fix double free on error Marc Zyngier
2024-04-13  8:44   ` Marc Zyngier

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=878r1hslcy.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=guanrui.huang@linux.alibaba.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shannon.zhao@linux.alibaba.com \
    --cc=tglx@linutronix.de \
    --cc=yuzenghui@huawei.com \
    /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.