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

[PATCH RESEND 1/6] sock: add sock_kzalloc helper

From: Thorsten Blum <thorsten.blum@linux.dev>
Date: 2026-05-27 08:26:07
Also in: linux-crypto, lkml
Subsystem: networking [general], networking [sockets], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kuniyuki Iwashima, Willem de Bruijn, Linus Torvalds

Add sock_kzalloc() helper - the sock equivalent to kzalloc().

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Patch 1/6 needs an Acked-by: from netdev maintainers for the series to
go through Herbert's crypto tree:
https://lore.kernel.org/lkml/ahVkZOxZtFes6Huf@gondor.apana.org.au/ (local)
---
 include/net/sock.h | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/include/net/sock.h b/include/net/sock.h
index 76bfd3e56d63..b521bd34ac9f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1913,6 +1913,11 @@ void sock_kfree_s(struct sock *sk, void *mem, int size);
 void sock_kzfree_s(struct sock *sk, void *mem, int size);
 void sk_send_sigurg(struct sock *sk);
 
+static inline void *sock_kzalloc(struct sock *sk, int size, gfp_t priority)
+{
+	return sock_kmalloc(sk, size, priority | __GFP_ZERO);
+}
+
 static inline void sock_replace_proto(struct sock *sk, struct proto *proto)
 {
 	if (sk->sk_socket)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help