Re: [libvirt] [PATCH 6/7] xend_internal.c: assure clang that we do not dereference NULL

[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/xen/xend_internal.c (xend_parse_sexp_desc_char): Add three
> uses of sa_assert, each preceding a strchr(value,... to assure
> clang that "value" is non-NULL.
> ---
>  src/xen/xend_internal.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index c4e73b7..950f1b5 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -1284,6 +1284,7 @@ xend_parse_sexp_desc_char(virBufferPtr buf,
>          virBufferVSprintf(buf, "      <source path='%s'/>\n",
>                            value);
>      } else if (STREQ(type, "tcp")) {
> +        sa_assert (value);
>          const char *offset = strchr(value, ':');

This introduces an expression before a declaration, even when sa_assert
is empty.  I know that we already rely on several other C99 features
(like __VA_ARGS__ from the preprocessor), but my understanding has been
that we have been trying to stick with C89 declarations first still.
Does this need to be refactored accordingly?

Besides, xend_parse_sexp_desc_char already dereferences value at line
1224; would it be possible to fix this by marking the argument as
NONNULL, rather than adding sa_assert()?

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