Linux cryptographic layer development
 help / color / mirror / Atom feed
From: chinayanlei2002@163.com
To: herbert@gondor.apana.org.au, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com
Cc: linux-crypto@vger.kernel.org, Yan Lei <yan_lei@dahuatech.com>
Subject: [PATCH] x86: crypto: fix Using uninitialized value walk.flags
Date: Sun, 10 Apr 2022 14:07:57 +0800	[thread overview]
Message-ID: <20220410060757.4009-1-chinayanlei2002@163.com> (raw)

From: Yan Lei <yan_lei@dahuatech.com>

----------------------------------------------------------
Using uninitialized value "walk.flags" when calling "skcipher_walk_virt".

Signed-off-by: Yan Lei <yan_lei@dahuatech.com>
---
 arch/x86/crypto/sm4_aesni_avx_glue.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/crypto/sm4_aesni_avx_glue.c b/arch/x86/crypto/sm4_aesni_avx_glue.c
index 7800f77d6..417e3bbfe 100644
--- a/arch/x86/crypto/sm4_aesni_avx_glue.c
+++ b/arch/x86/crypto/sm4_aesni_avx_glue.c
@@ -40,7 +40,7 @@ static int sm4_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
 
 static int ecb_do_crypt(struct skcipher_request *req, const u32 *rkey)
 {
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
@@ -94,7 +94,7 @@ int sm4_cbc_encrypt(struct skcipher_request *req)
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 	struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm);
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
@@ -128,7 +128,7 @@ int sm4_avx_cbc_decrypt(struct skcipher_request *req,
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 	struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm);
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
@@ -192,7 +192,7 @@ int sm4_cfb_encrypt(struct skcipher_request *req)
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 	struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm);
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
@@ -234,7 +234,7 @@ int sm4_avx_cfb_decrypt(struct skcipher_request *req,
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 	struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm);
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
@@ -303,7 +303,7 @@ int sm4_avx_ctr_crypt(struct skcipher_request *req,
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
 	struct sm4_ctx *ctx = crypto_skcipher_ctx(tfm);
-	struct skcipher_walk walk;
+	struct skcipher_walk walk = { 0 };
 	unsigned int nbytes;
 	int err;
 
-- 
2.30.0


             reply	other threads:[~2022-04-18 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10  6:07 chinayanlei2002 [this message]
2022-04-18 19:30 ` [PATCH] x86: crypto: fix Using uninitialized value walk.flags Eric Biggers

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=20220410060757.4009-1-chinayanlei2002@163.com \
    --to=chinayanlei2002@163.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=yan_lei@dahuatech.com \
    /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