All of lore.kernel.org
 help / color / mirror / Atom feed
* Compiler warning - ipv4 fib_trie
@ 2019-02-04 11:55 Koen Vandeputte
  2019-02-05  2:53 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Koen Vandeputte @ 2019-02-04 11:55 UTC (permalink / raw)
  To: netdev

Hi All,

During compilation of kernel 4.14.96 and 5.0-rc5 I'm seeing following 
warning:

net/ipv4/fib_trie.c: In function 'fib_trie_unmerge':
net/ipv4/fib_trie.c:1749:8: warning: 'local_tp' may be used 
uninitialized in this function [-Wmaybe-uninitialized]
     if (fib_insert_alias(lt, local_tp, local_l, new_fa,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            NULL, l->key)) {
            ~~~~~~~~~~~~~

Code:

https://elixir.bootlin.com/linux/v5.0-rc5/source/net/ipv4/fib_trie.c#L1731

Looks like 'local_tp' should be NULL-ified


Thanks,

Koen


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compiler warning - ipv4 fib_trie
  2019-02-04 11:55 Compiler warning - ipv4 fib_trie Koen Vandeputte
@ 2019-02-05  2:53 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-02-05  2:53 UTC (permalink / raw)
  To: Koen Vandeputte, netdev

On 2/4/19 3:55 AM, Koen Vandeputte wrote:
> Hi All,
> 
> During compilation of kernel 4.14.96 and 5.0-rc5 I'm seeing following
> warning:
> 
> net/ipv4/fib_trie.c: In function 'fib_trie_unmerge':
> net/ipv4/fib_trie.c:1749:8: warning: 'local_tp' may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>     if (fib_insert_alias(lt, local_tp, local_l, new_fa,
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>            NULL, l->key)) {
>            ~~~~~~~~~~~~~
> 
> Code:
> 
> https://elixir.bootlin.com/linux/v5.0-rc5/source/net/ipv4/fib_trie.c#L1731
> 
> Looks like 'local_tp' should be NULL-ified
> 
> 
> Thanks,
> 
> Koen
> 

I believe that is a false positive. If you analyze the loop, local_tp is
set when local_l is NULL and it is set before the first use. I am
surprised the compiler can not track that. fib_find_node has 1 return
point and local_tp is set right before.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-05  2:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 11:55 Compiler warning - ipv4 fib_trie Koen Vandeputte
2019-02-05  2:53 ` David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.