Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3f0666ee3039443fa7b7cf436dd16ce0dd8e3f95 Commit: 3f0666ee3039443fa7b7cf436dd16ce0dd8e3f95 Parent: c308c1b20e2eb7b13f200a7c18b3f23561318367 Author: Pavel Emelyanov <[EMAIL PROTECTED]> AuthorDate: Thu Nov 1 00:34:42 2007 -0700 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Thu Nov 1 00:34:42 2007 -0700
[NET]: Auto-zero the allocated sock object We have a __GFP_ZERO flag that allocates a zeroed chunk of memory. Use it in the sk_alloc() and avoid a hand-made memset(). This is a temporary patch that will help us in the nearest future :) Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- net/core/sock.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index 6ee2ed1..b66f607 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 - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html