qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 23/25] fdc: Move floppy geometry guessing back f


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 23/25] fdc: Move floppy geometry guessing back from block.c
Date: Tue, 10 Jul 2012 09:41:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Am 09.07.2012 19:01, schrieb Anthony Liguori:
> On 07/09/2012 11:46 AM, Eric Blake wrote:
>> On 07/09/2012 10:07 AM, Markus Armbruster wrote:
>>
>>>>> This is an unconditional use of fd_type[0].  If floppy == NULL, this is
>>>>> dereferencing an uninitialized value.
>>>>>
>>>>> I'm not sure why the explicit initialization was removed...
>>>
>>> Brain fart on my part, sorry.  The old loop assigns only if the drive
>>> exists.  The new loop assigns unconditionally.  Except the whole loop is
>>> still conditional.
>>>
>>> Testing can't flag this, because floppy is never null.
>>>
>>>> Looks broken indeed. I just wonder why my gcc (or the buildbots) didn't
>>>> complain.
>>>
>>> Me too.  Looks like I should upgrade to a more recent gcc.
>>
>> It's probably not the version of the gcc you used, but whether or not
>> your CFLAGS include -O2.  Gcc has the (IMO very annoying) limitation
>> that uninitialized-use analysis can only be performed if you are also
>> doing optimization.  You have to use a tool like clang or Coverity if
>> you want more reliable uninitialized-use analysis even while building
>> -O0 debug images.
>>
> 
> Specifically, without -O, GCC doesn't do data flow analysis so any warning 
> that 
> requires DFA won't get triggered.
> 
> So in general, if you are normally building with -O0, make sure to also build 
> with -O in order to get full warnings.

Just checked it to be sure, this doesn't seem to be the reason:

CFLAGS=-O2 -D_FORTIFY_SOURCE=2 -g

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]