Re: [libvirt] [PATCH 7/7] qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang

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

 



Eric Blake wrote:
> On 04/14/2010 10:02 AM, Jim Meyering wrote:
>> From: Jim Meyering <meyering@xxxxxxxxxx>
>>
>> * src/util/conf.c (virConfParseValue): Add an sa_assert.
>> ---
>>  src/util/conf.c |    9 ++++++++-
>>  1 files changed, 8 insertions(+), 1 deletions(-)
>
> A little more context makes this obvious:

Good point.  Applies to a couple others, too.
I'll try to make things easier to review next time.

Thanks for the prompt reviews.

>         if ((ctxt->cur < ctxt->end) && (CUR != ']')) {
>             if ((lst = virConfParseValue(ctxt)) == NULL)
>                 return(NULL);
>>              SKIP_BLANKS_AND_EOL;
>>          }
>>          while ((ctxt->cur < ctxt->end) && (CUR != ']')) {
>> +
>> +            /* Tell Clang that when execution reaches this point
>> +               "lst" is guaranteed to be non-NULL.  This stops it
>> +               from issuing an invalid NULL-dereference warning about
>> +               "prev = lst; while (prev->next..." below.  */
>> +            sa_assert (lst);
>> +
>
> Either we never enter the while loop, or the previous if must have been
> true and lst was assigned.  So ACK, if 1/7 is approved.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]