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

Re: [Xen-devel] [PATCH v2] xl: initialise rc before using it in vcpuset



On Wed, 2015-11-04 at 11:47 +0000, Ian Campbell wrote:
> On Wed, 2015-11-04 at 12:38 +0100, Dario Faggioli wrote:
> > On Wed, 2015-11-04 at 11:32 +0000, Wei Liu wrote:
> > 
> > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> > > index 2756d2f..9b6b42c 100644
> > > --- a/tools/libxl/xl_cmdimpl.c
> > > +++ b/tools/libxl/xl_cmdimpl.c
> > > @@ -5473,7 +5473,8 @@ static int vcpuset(uint32_t domid, const
> > > char*
> > > nr_vcpus, int check_host)
> > >          if (rc)
> > >              return 1;
> > >      }
> > > -    if (libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus)) {
> > > +    rc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus);
> > > +    if (rc) {
> > >          fprintf(stderr, "libxl_cpu_bitmap_alloc failed, rc:
> > > %d\n",
> > > rc);
> > >          return 1;
> > >      }
> > > 
> > Don't we also need to initialise rc to 0? It seems to me that it
> > may be
> > used uninitialised also inside of if(check_host)...
> 
> Looks like it, a separate issue though.
> 
The compiler is not spotting it again, though (just as a side note).

> Don't initialise rc to 0, add a suitable else though.
> 
Yeah, sure, I figured that out after having sent the mail. I'll send a
patch.

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.