qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH for-5.2?] nbd: Silence Coverity false positive


From: Eric Blake
Subject: Re: [PATCH for-5.2?] nbd: Silence Coverity false positive
Date: Thu, 12 Nov 2020 15:09:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

On 11/12/20 3:04 PM, Richard Henderson wrote:
> On 11/11/20 8:35 AM, Eric Blake wrote:
>> -    if (!full) {
>> -        /* last non dirty extent */
>> -        nbd_extent_array_add(es, end - start, 0);
>> +    if (!full && nbd_extent_array_add(es, end - start, 0) < 0) {
>> +        /* last non dirty extent, nothing to do if array was already full */
>>      }
> 
> Casting to (void) is another way to get rid of the warning.
> 
> I dunno which makes more sense here.  Definitely the comment is helpful.

As in:

if (!full) {
    /* last non dirty extent, nothing to do if array is now full */
    (void) nbd_extent_array_add(es, end - start, 0);
}

Yeah, that looks a little better.  Should I post that as v2, or wait for
further comments on this?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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