[libvirt] [PATCH 01/11] qemu: monitor: Extract handling of JSON block job error codes

John Ferlan jferlan at redhat.com
Thu Apr 9 09:31:08 UTC 2015



On 04/09/2015 05:26 AM, Peter Krempa wrote:

>> Because you touched it - Coverity whines that 'error' is not checked for
>> NULL:
>>
>> (8) Event returned_null: 	"virJSONValueObjectGet" returns null (checked
>> 96 out of 99 times). [details]
>> (16) Event var_assigned: 	Assigning: "error" = null return value from
>> "virJSONValueObjectGet".
>> Also see events:
>> (17) Event dereference: 	Dereferencing a pointer that might be null
>> "error" when calling "virJSONValueObjectGetString". [details]
> 
> I hate coverity for this. That's a false positive due to the fact that
> we check right away that the reply object contains the error subobject.
> 

How about a "sa_assert(event);"

Coverity is only complaining because so many places check "if (error) ?
xxx : yyy"

And yes it does work, I just checked

John
>>
>>
>> There's many examples (96) of checking...
> 
> Many examples, but here it's useless. The check will make it ugly. 
> 
>>
>> ACK with the check
> 
> I'll send a new version that will have different control flow. If we are
> going to uglyfy this function for coverity, we might as well as fix it
> so that the error object is not looked up several times which will then
> make the coverity error disappear.
> 
> The downside will be that it will not be straight move of code.
> 
> Peter
> 




More information about the libvir-list mailing list