conf: Fix off-by-one in virDomainDefGetVcpu

Cpus are indexed starting from '0' so the check was invalid.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316384
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1316420
This commit is contained in:
Peter Krempa 2016-03-10 09:46:53 +01:00
parent 4a39149b69
commit 8c7b7c4b0b

View File

@ -1405,7 +1405,7 @@ virDomainVcpuInfoPtr
virDomainDefGetVcpu(virDomainDefPtr def,
unsigned int vcpu)
{
if (vcpu > def->maxvcpus) {
if (vcpu >= def->maxvcpus) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("vCPU '%u' is not present in domain definition"),
vcpu);