netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* -Wsometimes-uninitialized Clang warning in net/tipc/node.c
@ 2019-03-08  0:17 Nathan Chancellor
  2019-03-20 19:07 ` Nathan Chancellor
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2019-03-08  0:17 UTC (permalink / raw)
  To: Jon Maloy, Ying Xue, David S. Miller, tipc-discussion
  Cc: netdev, linux-kernel, Nick Desaulniers, clang-built-linux

Hi all,

We are trying to get Clang's -Wsometimes-uninitialized turned on for the
kernel as it can catch some bugs that GCC can't. This warning came up:

net/tipc/node.c:831:6: warning: variable 'maddr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        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;
                                     ^
                                      = NULL
1 warning generated.

This definitely appears to be a legitimate warning but I'm not sure of
the proper solution (should maddr be initialized to NULL or should it be
set to something different in the else branch). Your input would be
greatly appreciated.

Cheers,
Nathan

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

end of thread, other threads:[~2019-03-21 19:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-08  0:17 -Wsometimes-uninitialized Clang warning in net/tipc/node.c Nathan Chancellor
2019-03-20 19:07 ` Nathan Chancellor
2019-03-20 20:50   ` Nick Desaulniers
2019-03-21 11:45     ` Arnd Bergmann
2019-03-21 14:57       ` Jon Maloy
2019-03-21 15:25         ` Arnd Bergmann
2019-03-21 18:22           ` Arnd Bergmann
2019-03-21 19:49             ` Jon Maloy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).