[PATCH 3/6] crypto: algif_aead - use sock_kzalloc in aead_accept_parent_nokey

Thorsten Blum
2026-04-27T10:43:54Z

simplify aead_accept_parent_nokey().

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 f8bd45f7dc83..83bb9a6bf85e 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -402,17 +402,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;