[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130720102657.768a11ea@nehalam.linuxnetplumber.net>
Date: Sat, 20 Jul 2013 10:26:57 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Pravin B Shelar <pshelar@...ira.com>,
David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: [PATCH net-next] ip: initialize hash list
Rather than relying on the assumption that zero means empty on
hash list head, the code should use the initialization macro.
Same effect, but follows API and avoids future breakage if hlist
implementation changes.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
--- a/net/ipv4/ip_tunnel.c 2013-07-19 09:12:37.213529343 -0700
+++ b/net/ipv4/ip_tunnel.c 2013-07-19 09:37:00.960764421 -0700
@@ -838,10 +838,15 @@ int ip_tunnel_init_net(struct net *net,
{
struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id);
struct ip_tunnel_parm parms;
+ unsigned i;
- itn->tunnels = kzalloc(IP_TNL_HASH_SIZE * sizeof(struct hlist_head), GFP_KERNEL);
+ itn->tunnels = kmalloc(IP_TNL_HASH_SIZE * sizeof(struct hlist_head),
+ GFP_KERNEL);
if (!itn->tunnels)
return -ENOMEM;
+
+ for (i = 0; i < IP_TNL_HASH_SIZE; i++)
+ INIT_HLIST_HEAD(&itn->tunnels[i]);
if (!ops) {
itn->fb_tunnel_dev = NULL;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists