Re: [PATCH 34/34] qemu: cgroup: Don't use priv->ncpupids to iterate domain vCPUs

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

 



On Tue, Nov 24, 2015 at 08:41:53 -0500, John Ferlan wrote:
> 
> 
> On 11/20/2015 10:22 AM, Peter Krempa wrote:
> > Use the proper data structures for the iteration since ncpupids will be
> > made private later.
> > ---
> >  src/qemu/qemu_cgroup.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> > index d8a2b03..06c20c1 100644
> > --- a/src/qemu/qemu_cgroup.c
> > +++ b/src/qemu/qemu_cgroup.c
> > @@ -800,7 +800,12 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
> >      if (virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
> >          goto error;
> > 
> > -    for (i = 0; i < priv->nvcpupids; i++) {
> > +    for (i = 0; i < virDomainDefGetVCpusMax(vm->def); i++) {
> > +        virDomainVCpuInfoPtr vcpu = virDomainDefGetVCpu(vm->def, i);
> > +
> 
> What if !vcpu?  Shouldn't happen, but not checked - trying to consider
> future too.

Actually it really can't and should not ever happen. The setters will
always allocate the array fully so iterating to virDomainDefGetVCpusMax
should always be valid.

Peter

Attachment: signature.asc
Description: Digital signature

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