Skip to content

Commit

Permalink
[NETNS]: Don't memset() netns to zero manually
Browse files Browse the repository at this point in the history
The newly created net namespace is set to 0 with memset()
in setup_net(). The setup_net() is also called for the
init_net_ns(), which is zeroed naturally as a global var.

So remove this memset and allocate new nets with the
kmem_cache_zalloc().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Oct 10, 2007
1 parent 0a8891a commit 32f0c4c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EXPORT_SYMBOL_GPL(init_net);

static struct net *net_alloc(void)
{
return kmem_cache_alloc(net_cachep, GFP_KERNEL);
return kmem_cache_zalloc(net_cachep, GFP_KERNEL);
}

static void net_free(struct net *net)
Expand Down Expand Up @@ -90,7 +90,6 @@ static int setup_net(struct net *net)
struct pernet_operations *ops;
int error;

memset(net, 0, sizeof(struct net));
atomic_set(&net->count, 1);
atomic_set(&net->use_count, 0);

Expand Down

0 comments on commit 32f0c4c

Please sign in to comment.