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

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



Eric Blake wrote:
> On 04/14/2010 10:02 AM, Jim Meyering wrote:
>> From: Jim Meyering <meyering redhat com>
>>
>> * 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.


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