[libvirt] [PATCH 2/2] vbox: Resolve Coverity CHECKED_RETURN

John Ferlan jferlan at redhat.com
Thu Nov 19 14:43:25 UTC 2015



On 11/19/2015 09:20 AM, Ján Tomko wrote:
> On Thu, Nov 19, 2015 at 09:06:05AM -0500, John Ferlan wrote:
>> Other callers check return from virDomainGraphicsListenSetAddress, but
>> vbox doesn't in it's vboxDumpDisplay. Follow other instances within vbox
>> to just ignore the return value in the vboxDump* functions.
>>
>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>>  src/vbox/vbox_common.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
> 
> NACK, this silences the error instead of resolving it.
> 
> You can achieve the same result by not running Coverity at all :)

Sure and we can ignore many other errors Coverity points out. Coverity
is a tool that points out flaws. Some are real, some are false
positives. I understand there is a dislike/distrust of the tool by some
for various reasons, but it is useful so I don't believe not running it
is a "viable option".

IMO: It seems the change is NACK'd based more on mentioning Coverity
than the 'usefulness' of the code checking the return status and causing
a failure. There are some far worse examples in vbox_common.c where
ignore_value is used in the virDump* calls on allocation failures which
then proceed to access what could have failed. You should have also
noted that vboxDumpDisplay is a "static void" so failure doesn't seem to
matter to the caller.

John

> 
> Jan
> 
>> diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
>> index 3e6ed7a..4576a07 100644
>> --- a/src/vbox/vbox_common.c
>> +++ b/src/vbox/vbox_common.c
>> @@ -3408,8 +3408,9 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
>>                  if (netAddressUtf16) {
>>                      VBOX_UTF16_TO_UTF8(netAddressUtf16, &netAddressUtf8);
>>                      if (STRNEQ(netAddressUtf8, ""))
>> -                        virDomainGraphicsListenSetAddress(def->graphics[def->ngraphics], 0,
>> -                                                          netAddressUtf8, -1, true);
>> +                        ignore_value(virDomainGraphicsListenSetAddress(
>> +                                     def->graphics[def->ngraphics], 0,
>> +                                     netAddressUtf8, -1, true));
>>                      VBOX_UTF16_FREE(netAddressUtf16);
>>                      VBOX_UTF8_FREE(netAddressUtf8);
>>                  }
>> -- 
>> 2.5.0
>>
>> --
>> libvir-list mailing list
>> libvir-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list