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

Daniel P. Berrange berrange at redhat.com
Wed Apr 14 17:41:27 UTC 2010


On Wed, Apr 14, 2010 at 06:02:36PM +0200, 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(-)
> 
> diff --git a/src/util/conf.c b/src/util/conf.c
> index ae0459e..38eb163 100644
> --- a/src/util/conf.c
> +++ b/src/util/conf.c
> @@ -1,7 +1,7 @@
>  /**
>   * conf.c: parser for a subset of the Python encoded Xen configuration files
>   *
> - * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
> + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
>   *
>   * See COPYING.LIB for the License of this software
>   *
> @@ -473,6 +473,13 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
>              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);
> +
>              if (CUR != ',') {
>                  virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
>                               _("expecting a separator in list"));

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list