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]
Message-ID: <20190109093026-mutt-send-email-mst@kernel.org>
Date:   Wed, 9 Jan 2019 09:30:37 -0500
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     Yi Wang <wang.yi59@....com.cn>
Cc:     jasowang@...hat.com, davem@...emloft.net,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, xue.zhihong@....com.cn,
        "huang.zijiang" <huang.zijiang@....com.cn>
Subject: Re: [PATCH] virtio:linux:kernel:NULL check after kmalloc is  needed

On Tue, Jan 08, 2019 at 01:40:33PM +0800, Yi Wang wrote:
> From: "huang.zijiang" <huang.zijiang@....com.cn>
> 
> NULL check is needed because kmalloc maybe return NULL.
> 
> Signed-off-by: huang.zijiang <huang.zijiang@....com.cn>

Can't hurt I will queue it.

> ---
>  tools/virtio/linux/kernel.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h
> index 7ef45a4..2afcad8 100644
> --- a/tools/virtio/linux/kernel.h
> +++ b/tools/virtio/linux/kernel.h
> @@ -65,6 +65,8 @@ static inline void *kzalloc(size_t s, gfp_t gfp)
>  {
>  	void *p = kmalloc(s, gfp);
>  
> +	if (!p)
> +		return -ENOMEM;
>  	memset(p, 0, s);
>  	return p;
>  }
> -- 
> 1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ