From patchwork Sat Jul 20 17:26:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 260463 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A26B52C0040 for ; Sun, 21 Jul 2013 03:27:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754686Ab3GTR1D (ORCPT ); Sat, 20 Jul 2013 13:27:03 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:37619 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754470Ab3GTR1A (ORCPT ); Sat, 20 Jul 2013 13:27:00 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro2so5550138pbb.13 for ; Sat, 20 Jul 2013 10:27:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding:x-gm-message-state; bh=2KWSxsJmkiZ93xX5pYo46YlGI9qGX8OLQbfQnZVSp/I=; b=fzHfpNNhqgGkjpeThMJ1H7cVEJS/RiCQi7oBEhI+/uPjAF99RJ/OajXfjX/D0f+RnK TB/an8UGL0YXXkqbcFElxFZWbBWplyPOGW73gSSws3MDeBQ0UCgpv1fcvlIluEBm5VU8 bZsWTCgwQp5PU8UkPWTYooFb4aZHMo8Tjia+cMuw2qcyGSW55j4mGi/DnJKz6Ygn5blH pAAQg4ifpqJzfy50lZWQ4Dngx5dnR2/FA/8Q6vdwmLnLl51737gFpbKZL9TfcyJN9F3b PhqgjV3evwF8F62qzM+iJW3DeKr5WpcIFFuTha/ybtjQNh/BM/hRwa0QvD7kHiKWQdzM 2OhA== X-Received: by 10.66.145.4 with SMTP id sq4mr24127493pab.46.1374341220222; Sat, 20 Jul 2013 10:27:00 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-71-109.bvtn.or.frontiernet.net. [50.53.71.109]) by mx.google.com with ESMTPSA id lk9sm29398252pab.2.2013.07.20.10.26.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 20 Jul 2013 10:26:59 -0700 (PDT) Date: Sat, 20 Jul 2013 10:26:57 -0700 From: Stephen Hemminger To: Pravin B Shelar , David Miller Cc: netdev@vger.kernel.org Subject: [PATCH net-next] ip: initialize hash list Message-ID: <20130720102657.768a11ea@nehalam.linuxnetplumber.net> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Gm-Message-State: ALoCoQlumpFB6docN5lKzzVQL34Rt5VTKoXdJ7nI3MKmIo41Zmkwt066zE/51wqf2OqfiJtT+H73 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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;