[PATCH 5/6] crypto: algif_rng - use sock_kzalloc in rng_accept_parent
From: Thorsten Blum
Date: Mon Apr 27 2026 - 06:45:31 EST
Replace sock_kmalloc() followed by memset(0) with sock_kzalloc() to
simplify rng_accept_parent().
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
crypto/algif_rng.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/crypto/algif_rng.c b/crypto/algif_rng.c
index a9fb492e929a..f609463f9e14 100644
--- a/crypto/algif_rng.c
+++ b/crypto/algif_rng.c
@@ -244,11 +244,10 @@ static int rng_accept_parent(void *private, struct sock *sk)
struct alg_sock *ask = alg_sk(sk);
unsigned int len = sizeof(*ctx);
- ctx = sock_kmalloc(sk, len, GFP_KERNEL);
+ ctx = sock_kzalloc(sk, len, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
- memset(ctx, 0, len);
ctx->len = len;
/*