All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Ye Bin <yebin10@huawei.com>
Cc: tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] irqchip/tango: Fix possible null ptr reference in tangox_irq_init
Date: Thu, 03 Sep 2020 09:10:16 +0100	[thread overview]
Message-ID: <25ddba499eaec2db3a70343c82669635@kernel.org> (raw)
In-Reply-To: <20200903015952.308888-1-yebin10@huawei.com>

On 2020-09-03 02:59, Ye Bin wrote:
> In tangox_irq_init allocate chip but not test.
> 
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  drivers/irqchip/irq-tango.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/irqchip/irq-tango.c b/drivers/irqchip/irq-tango.c
> index 34290f09b853..25da120230ad 100644
> --- a/drivers/irqchip/irq-tango.c
> +++ b/drivers/irqchip/irq-tango.c
> @@ -187,6 +187,8 @@ static int __init tangox_irq_init(void __iomem
> *base, struct resource *baseres,
>  		panic("%pOFn: failed to get address", node);
> 
>  	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
> +	if (!chip)
> +		panic("%pOFn: failed to get chip", node);
>  	chip->ctl = res.start - baseres->start;
>  	chip->base = base;

So you are trading a panic for a panic? What is the point?
A failing kzalloc already gives you all the information you may
need.

         M.
-- 
Jazz is not dead. It just smells funny...

      reply	other threads:[~2020-09-03  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  1:59 [PATCH] irqchip/tango: Fix possible null ptr reference in tangox_irq_init Ye Bin
2020-09-03  8:10 ` Marc Zyngier [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=25ddba499eaec2db3a70343c82669635@kernel.org \
    --to=maz@kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yebin10@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.