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]

 



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:

        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.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]