From: Ján Tomko Date: Thu, 3 Apr 2014 17:38:54 +0000 (+0200) Subject: Check maximum startcpu value correctly X-Git-Tag: v1.2.4-rc1~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9fe5267adecc6c87074ce673626a73ea4d9f2d6e;p=thirdparty%2Flibvirt.git Check maximum startcpu value correctly The cpus are indexed from 0, so a startcpu value equal to the number of CPUs is invalid. https://bugzilla.redhat.com/show_bug.cgi?id=1070680 --- diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index de572764e2..2272bc65b4 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -2928,10 +2928,10 @@ virCgroupGetPercpuStats(virCgroupPtr group, goto cleanup; } - if (start_cpu > total_cpus) { + if (start_cpu >= total_cpus) { virReportError(VIR_ERR_INVALID_ARG, _("start_cpu %d larger than maximum of %d"), - start_cpu, total_cpus); + start_cpu, total_cpus - 1); goto cleanup; }