Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332275

Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings

From Jeff Merkey <linux.mdb@gmail.com>
Newsgroups linux.kernel
Subject Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings
Date 2016-02-11 19:20 +0100
Message-ID <r140q-40Y-11@gated-at.bofh.it> (permalink)
References <r0PXr-2XH-1@gated-at.bofh.it> <r106w-1qh-69@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2/11/16, Theodore Ts'o <tytso@mit.edu> wrote:
> 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
>

Hi Ted,

That's good to know, they could be false positives, but it was kind of
wierd behavior caused by that macro.

Jeff

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-11 04:20 +0100
  Re: [BUG REPORT] use of unreachable() masks uninitialized variables  warnings Theodore Ts'o <tytso@mit.edu> - 2016-02-11 15:10 +0100
    Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-11 19:20 +0100
      Re: [BUG REPORT] use of unreachable() masks uninitialized variables  warnings Theodore Ts'o <tytso@mit.edu> - 2016-02-12 03:50 +0100
        Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-12 05:20 +0100
        Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-12 05:30 +0100
          Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-12 05:50 +0100
        Re: [BUG REPORT] use of unreachable() masks uninitialized variables warnings Jeff Merkey <linux.mdb@gmail.com> - 2016-02-12 06:00 +0100

csiph-web