Skip to content

Commit

Permalink
fib_trie: Fix uninitialized variable warning
Browse files Browse the repository at this point in the history
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: 0ddcf43 ("ipv4: FIB Local/MAIN table collapse")

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Mar 11, 2015
1 parent 6dede75 commit 61f0d86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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
Expand Down

0 comments on commit 61f0d86

Please sign in to comment.