[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190308001723.GA11197@archlinux-ryzen>
Date: Thu, 7 Mar 2019 17:17:23 -0700
From: Nathan Chancellor <natechancellor@...il.com>
To: Jon Maloy <jon.maloy@...csson.com>,
Ying Xue <ying.xue@...driver.com>,
"David S. Miller" <davem@...emloft.net>,
tipc-discussion@...ts.sourceforge.net
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
clang-built-linux@...glegroups.com
Subject: -Wsometimes-uninitialized Clang warning in net/tipc/node.c
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
Powered by blists - more mailing lists