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: <20230727080548.8666-1-zhangyiqun@phytium.com.cn>
Date:   Thu, 27 Jul 2023 16:05:48 +0800
From:   Zhang Yiqun <zhangyiqun@...tium.com.cn>
To:     herbert@...dor.apana.org.au, davem@...emloft.net
Cc:     linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
        Zhang Yiqun <zhangyiqun@...tium.com.cn>
Subject: [PATCH] crypto: all - alloc and init all req alloc as zero

This patch is to change all req struct alloc function from kmalloc
to kzalloc. Sometimes, it will incur some errors without initialized
zero.

Signed-off-by: Zhang Yiqun <zhangyiqun@...tium.com.cn>
---
 include/crypto/akcipher.h | 2 +-
 include/crypto/hash.h     | 2 +-
 include/crypto/kpp.h      | 2 +-
 include/crypto/skcipher.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/crypto/akcipher.h b/include/crypto/akcipher.h
index 670508f1dca1..b6f2121fcb85 100644
--- a/include/crypto/akcipher.h
+++ b/include/crypto/akcipher.h
@@ -223,7 +223,7 @@ static inline struct akcipher_request *akcipher_request_alloc(
 {
 	struct akcipher_request *req;
 
-	req = kmalloc(sizeof(*req) + crypto_akcipher_reqsize(tfm), gfp);
+	req = kzalloc(sizeof(*req) + crypto_akcipher_reqsize(tfm), gfp);
 	if (likely(req))
 		akcipher_request_set_tfm(req, tfm);
 
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index f7c2a22cd776..38429fb7bbf7 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -651,7 +651,7 @@ static inline struct ahash_request *ahash_request_alloc(
 {
 	struct ahash_request *req;
 
-	req = kmalloc(sizeof(struct ahash_request) +
+	req = kzalloc(sizeof(struct ahash_request) +
 		      crypto_ahash_reqsize(tfm), gfp);
 
 	if (likely(req))
diff --git a/include/crypto/kpp.h b/include/crypto/kpp.h
index 1988e24a0d1d..b4622bb747f9 100644
--- a/include/crypto/kpp.h
+++ b/include/crypto/kpp.h
@@ -201,7 +201,7 @@ static inline struct kpp_request *kpp_request_alloc(struct crypto_kpp *tfm,
 {
 	struct kpp_request *req;
 
-	req = kmalloc(sizeof(*req) + crypto_kpp_reqsize(tfm), gfp);
+	req = kzalloc(sizeof(*req) + crypto_kpp_reqsize(tfm), gfp);
 	if (likely(req))
 		kpp_request_set_tfm(req, tfm);
 
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 080d1ba3611d..a35e6e6221e1 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -521,7 +521,7 @@ static inline struct skcipher_request *skcipher_request_alloc(
 {
 	struct skcipher_request *req;
 
-	req = kmalloc(sizeof(struct skcipher_request) +
+	req = kzalloc(sizeof(struct skcipher_request) +
 		      crypto_skcipher_reqsize(tfm), gfp);
 
 	if (likely(req))
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ