[PATCH 5/6] crypto: algif_rng - use sock_kzalloc in rng_accept_parent

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

simplify rng_accept_parent().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
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;

/*