From patchwork Wed Mar 11 21:02:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 449198 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 070481400B6 for ; Thu, 12 Mar 2015 08:02:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825AbbCKVCT (ORCPT ); Wed, 11 Mar 2015 17:02:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752810AbbCKVCS (ORCPT ); Wed, 11 Mar 2015 17:02:18 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2BL2HHN019802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Mar 2015 17:02:17 -0400 Received: from [192.168.122.173] (ovpn-112-81.phx2.redhat.com [10.3.112.81]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2BL2GnR013477; Wed, 11 Mar 2015 17:02:17 -0400 Subject: [PATCH] fib_trie: Fix uninitialized variable warning From: Alexander Duyck To: netdev@vger.kernel.org Cc: davem@davemloft.net Date: Wed, 11 Mar 2015 14:02:16 -0700 Message-ID: <20150311210211.7975.98821.stgit@ahduyck-vm-fedora20> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The 0-day kernel test infrastructure reported a use of uninitialized variable warning for local_table due to the fact that the local and main allocations had been swapped from the original setup. This change corrects that by making it so that we free the main table if the local table allocation fails. Fixes: 0ddcf43d5 ("ipv4: FIB Local/MAIN table collapse") Signed-off-by: Alexander Duyck --- net/ipv4/fib_frontend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 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 diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 7cda3b0..d098987 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -54,11 +54,11 @@ static int __net_init fib4_rules_init(struct net *net) main_table = fib_trie_table(RT_TABLE_MAIN, NULL); if (main_table == NULL) - goto fail; + return -ENOMEM; local_table = fib_trie_table(RT_TABLE_LOCAL, main_table); if (local_table == NULL) - return -ENOMEM; + goto fail; hlist_add_head_rcu(&local_table->tb_hlist, &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX]); @@ -67,7 +67,7 @@ static int __net_init fib4_rules_init(struct net *net) return 0; fail: - fib_free_table(local_table); + fib_free_table(main_table); return -ENOMEM; } #else