On gio, 2013-12-19 at 21:32 -0700, Jim Fehlig wrote: > > Signed-off-by: Dario Faggioli <[email protected]> > > Cc: Jim Fehlig <[email protected]> > > Cc: Ian Jackson <[email protected]> > > --- > > src/libxl/libxl_driver.c | 83 > > ++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 83 insertions(+)
> > +static int
> > +libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
> > + unsigned char *cpumaps, int maplen,
> > + unsigned int flags)
> > +{
> > + libxlDriverPrivatePtr driver = dom->conn->privateData;
> > + libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
> > + virDomainObjPtr vm = NULL;
> > + virDomainDefPtr targetDef = NULL;
> > + virDomainVcpuPinDefPtr *vcpupin_list;
> > + virBitmapPtr cpumask = NULL;
> > + int maxcpu, hostcpus, vcpu, pcpu, n, ret = -1;
> > + unsigned char *cpumap;
> > + bool pinned;
> > +
> > + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> > + VIR_DOMAIN_AFFECT_CONFIG, -1);
> > +
> > + if (!(vm = libxlDomObjFromDomain(dom)))
> > + goto cleanup;
> > +
> > + if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
> > + goto cleanup;
> > +
> > + if (virDomainLiveConfigHelperMethod(cfg->caps, driver->xmlopt, vm,
> > + &flags, &targetDef) < 0)
> > + goto cleanup;
> > +
> > + if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> > + targetDef = vm->def;
> > + }
> > +
> > + sa_assert(targetDef);
> >
>
> I think we should add a comment stating this is needed to silence
> Coverity, similar to the qemu driver.
>
Ok, I'll do.
> > +
> > + /* Clamp to actual number of vcpus */
> > + if (ncpumaps > targetDef->vcpus)
> > + ncpumaps = targetDef->vcpus;
> > +
> > + if (!cpumaps || ncpumaps < 1) {
> > + virReportError(VIR_ERR_INVALID_ARG, "%s",
> > + _("cannot return affinity via a NULL pointer"));
> > + goto cleanup;
> > + }
> >
>
> cpumaps is guaranteed to be non-NULL on entry and ncpumaps is guaranteed
> to be > 0 on entry, so the above check can be removed.
>
Right! I actually did saw that, but then forgot when going down to code
the thing. :-)
I'll get rid of this in v2.
Thanks and 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)
signature.asc
Description: This is a digitally signed message part
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
