All of lore.kernel.org
 help / color / mirror / Atom feed
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: Re: -Wsometimes-uninitialized Clang warning in net/tipc/node.c
Date: Wed, 20 Mar 2019 12:07:52 -0700	[thread overview]
Message-ID: <20190320190752.GA28744@archlinux-ryzen> (raw)
In-Reply-To: <20190308001723.GA11197@archlinux-ryzen>

On Thu, Mar 07, 2019 at 05:17:23PM -0700, Nathan Chancellor wrote:
> 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

Gentle ping (if there was a response to this, I didn't receive it). I
know I sent it in the middle of a merge window so I get if it slipped
through the cracks.

Thanks,
Nathan

  reply	other threads:[~2019-03-20 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  0:17 -Wsometimes-uninitialized Clang warning in net/tipc/node.c Nathan Chancellor
2019-03-20 19:07 ` Nathan Chancellor [this message]
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=20190320190752.GA28744@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.