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] [day] [month] [year] [list]
Date:   Tue, 29 Mar 2022 11:35:01 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     QintaoShen <unSimple1993@....com>, <tsbogend@...ha.franken.de>
CC:     <linux-kernel@...r.kernel.org>, <linux-mips@...r.kernel.org>,
        <ralf@...ux-mips.org>
Subject: Re: [PATCH v1] MIPS: ip22-gio: Add check for the return value of
 kzalloc()

Hello!

On 3/28/22 11:04 AM, QintaoShen wrote:

> Since the memory allocation function kzalloc() may return a NULL pointer,
> the use of 'gio_dev' may lead to NULL pointer dereference.
> 
> So it is better to check the return value of kzalloc().
> 
> Signed-off-by: QintaoShen <unSimple1993@....com>
> ---
>  arch/mips/sgi-ip22/ip22-gio.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
> index dfc52f6..df7ca21 100644
> --- a/arch/mips/sgi-ip22/ip22-gio.c
> +++ b/arch/mips/sgi-ip22/ip22-gio.c
> @@ -363,7 +363,11 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
>  		printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
>  		       slotno, name, id);
>  		gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
> -		gio_dev->name = name;
> +		
> +        if (!gio_dev)

   Indented too little. And indent with tabs please, not spaces.

> +            return ;

   No need for space before ';'.

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ