On Tue, Dec 17, 2013 at 3:27 PM, David Sterba <dsterba@xxxxxxx> wrote:
> On Mon, Dec 16, 2013 at 05:03:25PM +0000, Filipe David Manana wrote:
>> On Mon, Dec 16, 2013 at 2:34 PM, David Sterba <dsterba@xxxxxxx> wrote:
>> > On Fri, Dec 13, 2013 at 07:39:34PM +0000, Filipe David Borba Manana wrote:
>> >> >From the compiler:
>> >>
>> >> fs/btrfs/file.c: In function ‘prepare_pages.isra.18’:
>> >> fs/btrfs/file.c:1265:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]
>> >
>> > My gcc 4.8.1 does not see this warning, nor do I while inspecting the
>> > souces in current next-master.
>>
>> Here it's gcc 4.6.3.
>
> I've seen that some versions of gcc produce bogus warnings of that sort
> and manual review is needed, but I haven't found a code path that would
> lead to uninitialized use of err.
>
> The warning points to
>
> 1259 if (i == 0)
> 1260 err = prepare_uptodate_page(pages[i], pos,
> 1261 force_uptodate);
> 1262 if (i == num_pages - 1)
> 1263 err = prepare_uptodate_page(pages[i],
> 1264 pos + write_bytes, false);
> 1265 if (err) {
> ^^^^
>
> 1266 page_cache_release(pages[i]);
> 1267 faili = i - 1;
> 1268 goto fail;
> 1269 }
>
> But the loop starts from i = 0 and the variable is initialized before
> the check. So ti's gcc that does not see that, not a real error.
Right, my intention was to silence a compiler warning. Should have
made it more explicit in the commit message title.
--
Filipe David Manana,
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html