From 8924f1b25646e939997dc42589604cc2230b4646 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 14 Sep 2016 06:50:00 +0200 Subject: [PATCH] qemu: process: Don't use shifted indexes for vcpu order verification Allocate a one larger bitmap rather than shifting the indexes back to zero. --- src/qemu/qemu_process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e4f27eaf5e..3b6e07811d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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)); }