lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Oct 2021 10:24:54 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     zhaoxiao <long870912@...il.com>
Cc:     chenhuacai@...nel.org, jiaxun.yang@...goat.com, tglx@...utronix.de,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhaoxiao <zhaoxiao@...ontech.com>
Subject: Re: [PATCH] irqchip/loongson-htvec:- Handle return value of ioremap.

On 2021-10-15 08:25, zhaoxiao wrote:
> From: zhaoxiao <zhaoxiao@...ontech.com>
> 
> Here, If ioremap will fail. It will return NULL.Kernel can run into
> a NULL-pointer dereference. This error check will avoid NULL pointer
> dereference.
> 
> Signed-off-by: zhaoxiao <zhaoxiao@...ontech.com>
> ---
>  drivers/irqchip/irq-loongson-htvec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/irqchip/irq-loongson-htvec.c
> b/drivers/irqchip/irq-loongson-htvec.c
> index 1cc0bceb4472..a36c20f44ec4 100644
> --- a/drivers/irqchip/irq-loongson-htvec.c
> +++ b/drivers/irqchip/irq-loongson-htvec.c
> @@ -267,6 +267,8 @@ struct fwnode_handle *htvec_acpi_init(struct
> fwnode_handle *parent,
> 
>  	priv->num_parents = HTVEC_MAX_PARENT_IRQ;
>  	priv->base = ioremap(acpi_htvec->address, acpi_htvec->size);
> +	if (!priv->base)
> +		goto free_priv;
> 
>  	/* Interrupt may come from any of the 8 interrupt lines */
>  	for (i = 0; i < priv->num_parents; i++)
> @@ -307,6 +309,7 @@ struct fwnode_handle *htvec_acpi_init(struct
> fwnode_handle *parent,
>  iounmap_base:
>  	iounmap(priv->base);
>  	priv->domain_handle = NULL;
> +free_priv:
>  	kfree(priv);
> 
>  	return NULL;

What is the difference between this and the patch you sent 3 days ago?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ