mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 22:15:20 +00:00
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:
parent
3d5dd28995
commit
8924f1b256
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user