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-next>] [day] [month] [year] [list]
Message-Id: <1546926033-31684-1-git-send-email-wang.yi59@zte.com.cn>
Date:   Tue, 8 Jan 2019 13:40:33 +0800
From:   Yi Wang <wang.yi59@....com.cn>
To:     mst@...hat.com
Cc:     jasowang@...hat.com, davem@...emloft.net,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, xue.zhihong@....com.cn,
        wang.yi59@....com.cn, "huang.zijiang" <huang.zijiang@....com.cn>
Subject: [PATCH] virtio:linux:kernel:NULL check after kmalloc is  needed

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>
---
 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