Re: [PATCH] Fix uninitialized variable in NWfilter IP learning code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 23, 2011 at 01:41:15PM +0100, Matthias Bolte wrote:
> 2011/11/23 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> >
> > Pushed as a build-breaker fix
> >
> > * src/nwfilter/nwfilter_learnipaddr.c: Initialize ret variable
> > ---
> >  src/nwfilter/nwfilter_learnipaddr.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
> > index 675ef5b..d924c4d 100644
> > --- a/src/nwfilter/nwfilter_learnipaddr.c
> > +++ b/src/nwfilter/nwfilter_learnipaddr.c
> > @@ -340,6 +340,7 @@ virNWFilterAddIpAddrForIfname(const char *ifname, char *addr)
> >     } else {
> >         if (virNWFilterVarValueAddValue(val, addr) < 0)
> >             ret = -1;
> > +        ret = 0;
> >     }
> >
> >  err_exit:
> 
> This looks wrong to me. You're overwriting a possible error from
> virNWFilterVarValueAddValue here. I don't think that this is intended.
> 
> Did you mean to initialize ret to zero on declaration, or put ret = 0
> in an else branch here instead?

Err, yes, i meant to have an else in there :-(  Lets just go with
Stefan's patch.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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