[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <25ddba499eaec2db3a70343c82669635@kernel.org>
Date: Thu, 03 Sep 2020 09:10:16 +0100
From: Marc Zyngier <maz@...nel.org>
To: Ye Bin <yebin10@...wei.com>
Cc: tglx@...utronix.de, jason@...edaemon.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] irqchip/tango: Fix possible null ptr reference in
tangox_irq_init
On 2020-09-03 02:59, Ye Bin wrote:
> In tangox_irq_init allocate chip but not test.
>
> Signed-off-by: Ye Bin <yebin10@...wei.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...
Powered by blists - more mailing lists