]> xenbits.xensource.com Git - libvirt.git/commitdiff
cpu_ppc64: Error out when model tag missing in virsh cpu-compare xml
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Mon, 18 Sep 2017 16:57:52 +0000 (22:27 +0530)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 12 Oct 2017 14:37:54 +0000 (16:37 +0200)
libvirtd throws unhandled signal 11 on ppc while running
virsh cpu-compare with missing model tag in the xml. This
patch errors out in such situation.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/cpu/cpu_ppc64.c

index b58e80a647f8298e2b5b02fe235761c2e190a99d..5c5fc0fec6aa57209b939fd4521e1327d9fb33f0 100644 (file)
@@ -247,6 +247,12 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
 {
     struct ppc64_model *model;
 
+    if (!cpu->model) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("no CPU model specified"));
+        return NULL;
+    }
+
     if (!(model = ppc64ModelFind(map, cpu->model))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unknown CPU model %s"), cpu->model);