[libvirt] [PATCH] nwfilter_conf.c: don't test an uninitialized local variable

Stefan Berger stefanb at us.ibm.com
Mon Mar 29 17:38:05 UTC 2010


libvir-list-bounces at redhat.com wrote on 03/29/2010 11:35:31 AM:


> 
> I've just run the code through clang, and it spotted a few new problems.
> Here's one:
> 
> >From 4c848787c8268e37db9a1d0754b8fcd8e5774f73 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Mon, 29 Mar 2010 17:34:32 +0200
> Subject: [PATCH] nwfilter_conf.c: don't test an uninitialized local 
variable
> 
> * src/conf/nwfilter_conf.c (virNWIPAddressFormat): Do not use "i"
> uninitialized.
> ---
>  src/conf/nwfilter_conf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
> index e82aae6..f673e69 100644
> --- a/src/conf/nwfilter_conf.c
> +++ b/src/conf/nwfilter_conf.c
> @@ -2423,7 +2423,7 @@ virNWIPAddressFormat(virBufferPtr buf, 
> nwIPAddressPtr ipaddr)
>                            ipaddr->addr.ipv4Addr[2],
>                            ipaddr->addr.ipv4Addr[3]);
>      } else {
> -        int i;
> +        unsigned int i = 0;
>          int dcshown = 0, in_dc = 0;
>          unsigned short n;
>          while (i < 8) {
> --
> 1.7.0.3.448.g82eeb


Thanks so much for looking at this. I do have a patch following Daniel 
V.'s suggestion to get rid of the home-cooked IPv6 parser/print function 
and it will do away with that code section.

 Regards,
    Stefan


> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100329/fd6712da/attachment-0001.htm>


More information about the libvir-list mailing list