]> xenbits.xensource.com Git - libvirt.git/commitdiff
Return error when --start <number> in cpu-stats is invalid.
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Fri, 15 Apr 2016 07:28:53 +0000 (03:28 -0400)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 15 Apr 2016 13:20:11 +0000 (15:20 +0200)
Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
tools/virsh-domain.c

index 800829eaea74dd4e6785c31f4b9079ae6e24e185..a1d4a75747457c3255d57cad6944a8676fa88d57 100644 (file)
@@ -7357,6 +7357,13 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
     /* get number of cpus on the node */
     if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0)
         goto failed_stats;
+
+    if (cpu >= max_id) {
+        vshError(ctl, "Start CPU %d is out of range (min: 0, max: %d)",
+                 cpu, max_id - 1);
+        goto cleanup;
+    }
+
     if (show_count < 0 || show_count > max_id) {
         if (show_count > max_id)
             vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id);