]> xenbits.xensource.com Git - libvirt.git/commitdiff
Check maximum startcpu value correctly
authorJán Tomko <jtomko@redhat.com>
Thu, 3 Apr 2014 17:38:54 +0000 (19:38 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 9 Apr 2014 14:24:08 +0000 (16:24 +0200)
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

index de572764e2792433a67d4a3c1361b6833580a1c9..2272bc65b4746a1332c5783f9583e205639f949d 100644 (file)
@@ -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;
     }