[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190323.214619.673138376627603694.davem@davemloft.net>
Date: Sat, 23 Mar 2019 21:46:19 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: jon.maloy@...csson.com
Cc: netdev@...r.kernel.org, gordan.mihaljevic@...tech.com.au,
tung.q.nguyen@...tech.com.au, hoang.h.le@...tech.com.au,
canh.d.luu@...tech.com.au, ying.xue@...driver.com,
tipc-discussion@...ts.sourceforge.net
Subject: Re: [net 1/1] tipc: tipc clang warning
From: Jon Maloy <jon.maloy@...csson.com>
Date: Fri, 22 Mar 2019 15:03:51 +0100
> When checking the code with clang -Wsometimes-uninitialized we get the
> following warning:
>
> if (!tipc_link_is_establishing(l)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> net/tipc/node.c:847:46: note: uninitialized use occurs here
> tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr);
>
> net/tipc/node.c:831:2: note: remove the 'if' if its condition is always
> true
> if (!tipc_link_is_establishing(l)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> net/tipc/node.c:821:31: note: initialize the variable 'maddr' to silence
> this warning
> struct tipc_media_addr *maddr;
>
> We fix this by initializing 'maddr' to NULL. For the matter of clarity,
> we also test if 'xmitq' is non-empty before we use it and 'maddr'
> further down in the function. It will never happen that 'xmitq' is non-
> empty at the same time as 'maddr' is NULL, so this is a sufficient test.
>
> Fixes: 598411d70f85 ("tipc: make resetting of links non-atomic")
> Reported-by: Nathan Chancellor <natechancellor@...il.com>
> Signed-off-by: Jon Maloy <jon.maloy@...csson.com>
Applied.
Powered by blists - more mailing lists