]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Fix off-by-one in virDomainDefGetVcpu
authorPeter Krempa <pkrempa@redhat.com>
Thu, 10 Mar 2016 08:46:53 +0000 (09:46 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 10 Mar 2016 12:58:44 +0000 (13:58 +0100)
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

src/conf/domain_conf.c

index 314a584d155951a2fadeb266d92d9ccb39cfff39..1aed318b674d5cbd0dd279dae1660e4bbbf2cf58 100644 (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);