From: Peter Krempa Date: Thu, 10 Mar 2016 08:46:53 +0000 (+0100) Subject: conf: Fix off-by-one in virDomainDefGetVcpu X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8c7b7c4b0bb0d58dfb2e3dcdf1855a7dc9c858d0;p=libvirt.git 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 --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 314a584d15..1aed318b67 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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);