[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xl: avoid (another) uninitialised use of rc in vcpuset()
On Wed, 2015-11-04 at 13:03 +0100, Dario Faggioli wrote: > Rearange the case when we check the new number of vCPUs > against the number of host pCPUs not to use rc for internal > error reporting. In fact: > Â- rc was at risk of being used uninitialised; > Â- rc should only be used for holding libxl error codes. > > Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> acked + applied. > --- > Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > Cc: Wei Liu <wei.liu2@xxxxxxxxxx> > Cc: Harmandeep Kaur <write.harmandeep@xxxxxxxxx> > Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > Âtools/libxl/xl_cmdimpl.c |ÂÂÂ12 ++++++------ > Â1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 9b6b42c..78048a1 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -5457,21 +5457,21 @@ static int vcpuset(uint32_t domid, const char* > nr_vcpus, int check_host) > ÂÂÂÂÂÂ* by the host's amount of pCPUs. > ÂÂÂÂÂÂ*/ > ÂÂÂÂÂif (check_host) { > -ÂÂÂÂÂÂÂÂunsigned int host_cpu = libxl_get_max_cpus(ctx); > +ÂÂÂÂÂÂÂÂunsigned int online_vcpus, host_cpu = libxl_get_max_cpus(ctx); > ÂÂÂÂÂÂÂÂÂlibxl_dominfo dominfo; > Â > ÂÂÂÂÂÂÂÂÂif (libxl_domain_info(ctx, &dominfo, domid)) > ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn 1; > Â > -ÂÂÂÂÂÂÂÂif (max_vcpus > dominfo.vcpu_online && max_vcpus > host_cpu) { > +ÂÂÂÂÂÂÂÂonline_vcpus = dominfo.vcpu_online; > +ÂÂÂÂÂÂÂÂlibxl_dominfo_dispose(&dominfo); > + > +ÂÂÂÂÂÂÂÂif (max_vcpus > online_vcpus && max_vcpus > host_cpu) { > ÂÂÂÂÂÂÂÂÂÂÂÂÂfprintf(stderr, "You are overcommmitting! You have %d > physical" \ > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ" CPUs and want %d vCPUs! Aborting, use --ignore- > host to" \ > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ" continue\n", host_cpu, max_vcpus); > -ÂÂÂÂÂÂÂÂÂÂÂÂrc = 1; > -ÂÂÂÂÂÂÂÂ} > -ÂÂÂÂÂÂÂÂlibxl_dominfo_dispose(&dominfo); > -ÂÂÂÂÂÂÂÂif (rc) > ÂÂÂÂÂÂÂÂÂÂÂÂÂreturn 1; > +ÂÂÂÂÂÂÂÂ} > ÂÂÂÂÂ} > ÂÂÂÂÂrc = libxl_cpu_bitmap_alloc(ctx, &cpumap, max_vcpus); > ÂÂÂÂÂif (rc) { > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |