qemu: process: Don't use shifted indexes for vcpu order verification

Allocate a one larger bitmap rather than shifting the indexes back to
zero.
This commit is contained in:
Peter Krempa 2016-09-14 06:50:00 +02:00
parent 3d5dd28995
commit 8924f1b256

View File

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