diff mbox

fib_trie: Fix uninitialized variable warning

Message ID 20150311210211.7975.98821.stgit@ahduyck-vm-fedora20
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Alexander Duyck March 11, 2015, 9:02 p.m. UTC
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 <alexander.h.duyck@redhat.com>
---
 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

Comments

David Miller March 11, 2015, 9:34 p.m. UTC | #1
From: Alexander Duyck <alexander.h.duyck@redhat.com>
Date: Wed, 11 Mar 2015 14:02:16 -0700

> 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 <alexander.h.duyck@redhat.com>

Applied, thanks Alex.
--
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 mbox

Patch

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