From: Nathan Chancellor <natechancellor@gmail.com>
To: Jon Maloy <jon.maloy@ericsson.com>,
Ying Xue <ying.xue@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
tipc-discussion@lists.sourceforge.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Nick Desaulniers <ndesaulniers@google.com>,
clang-built-linux@googlegroups.com
Subject: -Wsometimes-uninitialized Clang warning in net/tipc/node.c
Date: Thu, 7 Mar 2019 17:17:23 -0700 [thread overview]
Message-ID: <20190308001723.GA11197@archlinux-ryzen> (raw)
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
next reply other threads:[~2019-03-08 0:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 0:17 Nathan Chancellor [this message]
2019-03-20 19:07 ` -Wsometimes-uninitialized Clang warning in net/tipc/node.c 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190308001723.GA11197@archlinux-ryzen \
--to=natechancellor@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.