Replace sock_kmalloc() followed by memset(0) with sock_kzalloc() to
simplify aead_accept_parent_nokey().
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
crypto/algif_aead.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index c6c2ce21895d..6ebc2f9f741d 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -408,17 +408,15 @@ static int aead_accept_parent_nokey(void *private, struct sock *sk)
unsigned int len = sizeof(*ctx);
unsigned int ivlen = crypto_aead_ivsize(tfm);
- ctx = sock_kmalloc(sk, len, GFP_KERNEL);
+ ctx = sock_kzalloc(sk, len, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
- memset(ctx, 0, len);
- ctx->iv = sock_kmalloc(sk, ivlen, GFP_KERNEL);
+ ctx->iv = sock_kzalloc(sk, ivlen, GFP_KERNEL);
if (!ctx->iv) {
sock_kfree_s(sk, ctx, len);
return -ENOMEM;
}
- memset(ctx->iv, 0, ivlen);
INIT_LIST_HEAD(&ctx->tsgl_list);
ctx->len = len;