* [PATCH][NETNS] Don't memset() netns to zero manually
@ 2007-10-09 11:48 Pavel Emelyanov
2007-10-09 20:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2007-10-09 11:48 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List, devel
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>
---
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0e0ca6d..6f71db8 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -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)
@@ -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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-09 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 11:48 [PATCH][NETNS] Don't memset() netns to zero manually Pavel Emelyanov
2007-10-09 20:02 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).