From: "Theodore Ts'o" <tytso@mit.edu>
To: Jeff Merkey <linux.mdb@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings
Date: Thu, 11 Feb 2016 09:06:37 -0500 [thread overview]
Message-ID: <20160211140637.GN26922@thunk.org> (raw)
In-Reply-To: <CAO6TR8X8GKoO5aaxcy8Hq+68a0S+ZXyLxY1D22Xs_9WJsQigaw@mail.gmail.com>
On Wed, Feb 10, 2016 at 08:13:09PM -0700, Jeff Merkey wrote:
> Here are the sources of several bugs I have seen recently in ext4 I am
> pretty sure with a null bh. One good check is to set the BUG() macro
> NOT TO call unreachable() as a build test since the compiler will
> ignore uninitialized variables in a function if someone calls BUG()
> even conditionally, and never report them during build.
>
> The following are from v4.4.1 with a BUG() macro with the call to
> unreachable() removed:
I checked all of the fs/ext4 warnings you listed and they are all
false positives.
> In file included from fs/ext4/file.c:30:0:
> fs/ext4/ext4_jbd2.h: In function ‘ext4_inode_journal_mode’:
> fs/ext4/ext4_jbd2.h:409:1: warning: control reaches end of non-void
> function [-Wreturn-type]
> }
This is from a:
if (foo) {
...
return foobie;
} else if (bar) {
...
return barbie;
} else {
BUG();
}
construct.
> fs/ext4/inode.c: In function ‘ext4_map_blocks’:
> fs/ext4/inode.c:548:5: warning: ‘retval’ may be used uninitialized in
> this function [-Wmaybe-uninitialized]
> if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) {
> ^
> fs/ext4/extents.c:2305:14: warning: ‘len’ may be used uninitialized in
> this function [-Wmaybe-uninitialized]
> ext4_lblk_t len;
> ^
All of the may be used uninitialized warnings are from a:
if (foo) {
...
retval = xxx;
} else if (bar) {
...
retval = yyy;
} else {
BUG();
}
construct.
It may be that there are some false warnings, but they certainly weren't
from warnings you've listed from ext4.
Cheers,
- Ted
next prev parent reply other threads:[~2016-02-11 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 3:13 [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey
2016-02-11 14:06 ` Theodore Ts'o [this message]
2016-02-11 18:12 ` Jeff Merkey
2016-02-12 2:41 ` Theodore Ts'o
2016-02-12 4:18 ` Jeff Merkey
2016-02-12 4:28 ` Jeff Merkey
2016-02-12 4:41 ` Jeff Merkey
2016-02-12 4:58 ` Jeff Merkey
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=20160211140637.GN26922@thunk.org \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.mdb@gmail.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 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).