[libvirt] [PATCH 5/6] Check maximum startcpu value correctly

Ján Tomko jtomko at redhat.com
Fri Apr 4 08:25:39 UTC 2014


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
---
 src/util/vircgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index de57276..2272bc6 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;
     }
 
-- 
1.8.3.2




More information about the libvir-list mailing list