提交 8924f1b2 编写于 作者: P Peter Krempa

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

Allocate a one larger bitmap rather than shifting the indexes back to
zero.
上级 3d5dd289
...@@ -4788,7 +4788,7 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def) ...@@ -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) ...@@ -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));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册