summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/core/sock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 6ee2ed104a83..b66f607fcb96 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -908,10 +908,12 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
{
struct sock *sk;
+ if (zero_it)
+ priority |= __GFP_ZERO;
+
sk = sk_prot_alloc(prot, priority);
if (sk) {
if (zero_it) {
- memset(sk, 0, prot->obj_size);
sk->sk_family = family;
/*
* See comment in struct sock definition to understand