[libvirt] [PATCH 7/7] qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang
Eric Blake
eblake at redhat.com
Wed Apr 14 16:57:47 UTC 2010
On 04/14/2010 10:02 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering at 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:
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100414/2e59dcd1/attachment-0001.sig>
More information about the libvir-list
mailing list