[PATCH 5/6] Check maximum startcpu value correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]