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 bd715b1..b40daee 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4772,7 +4772,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def)
virBitmapPtr ordermap = NULL;
int ret = -1;
- if (!(ordermap = virBitmapNew(maxvcpus)))
+ if (!(ordermap = virBitmapNew(maxvcpus + 1)))
goto cleanup;
/* validate:
@@ -4789,13 +4789,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));
}
--
2.10.0