[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191018050457.13809-1-kjlu@umn.edu>
Date: Fri, 18 Oct 2019 00:04:56 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] crypto: hash - initializing memory buffer for keys
"ctx" is uninitialized. To avoid undefined behaviors or memory
disclosures, we better initialize it.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
crypto/algif_hash.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 178f4cd75ef1..129a124e5056 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -433,6 +433,7 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
ctx = sock_kmalloc(sk, len, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
+ memset(ctx, 0, len);
ctx->result = NULL;
ctx->len = len;
--
2.17.1
Powered by blists - more mailing lists