mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Yiqun <zhangyiqun@phytium.com.cn>
To: herbert@gondor.apana.org.au, davem@davemloft.net
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhang Yiqun <zhangyiqun@phytium.com.cn>
Subject: [PATCH] crypto: all - alloc and init all req alloc as zero
Date: Thu, 27 Jul 2023 16:05:48 +0800	[thread overview]
Message-ID: <20230727080548.8666-1-zhangyiqun@phytium.com.cn> (raw)

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@phytium.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


             reply	other threads:[~2023-07-27  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  8:05 Zhang Yiqun [this message]
2023-07-27  8:07 ` Herbert Xu
2023-07-28  9:06   ` 张轶群

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230727080548.8666-1-zhangyiqun@phytium.com.cn \
    --to=zhangyiqun@phytium.com.cn \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®