diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e4f27eaf5e3e5545a49a3deb8c49e349dfae2117..3b6e07811d2a0eda9d5bd83ecbc735400a183a62 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)); }