Thread (9 messages) 9 messages, 2 authors, 9d ago
COOLING9d REVIEWED: 3 (3M)

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

From: Thorsten Blum <thorsten.blum@linux.dev>
Date: 2026-05-27 08:26:02
Also in: linux-crypto, lkml
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

Replace sock_kmalloc() followed by memset(0) with sock_kzalloc() to
simplify rng_accept_parent().

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
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;
 
 	/*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help