]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: process: Don't use shifted indexes for vcpu order verification
authorPeter Krempa <pkrempa@redhat.com>
Wed, 14 Sep 2016 04:50:00 +0000 (06:50 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 30 Sep 2016 06:25:20 +0000 (08:25 +0200)
Allocate a one larger bitmap rather than shifting the indexes back to
zero.

src/qemu/qemu_process.c

index e4f27eaf5e3e5545a49a3deb8c49e349dfae2117..3b6e07811d2a0eda9d5bd83ecbc735400a183a62 100644 (file)
@@ -4788,7 +4788,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def)
     virBitmapPtr ordermap = NULL;
     int ret = -1;
 
-    if (!(ordermap = virBitmapNew(maxvcpus)))
+    if (!(ordermap = virBitmapNew(maxvcpus + 1)))
         goto cleanup;
 
     /* validate:
@@ -4805,13 +4805,13 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def)
             continue;
 
         if (vcpu->order != 0) {
-            if (virBitmapIsBitSet(ordermap, vcpu->order - 1)) {
+            if (virBitmapIsBitSet(ordermap, vcpu->order)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("duplicate vcpu order '%u'"), vcpu->order);
                 goto cleanup;
             }
 
-            ignore_value(virBitmapSetBit(ordermap, vcpu->order - 1));
+            ignore_value(virBitmapSetBit(ordermap, vcpu->order));
         }