summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-19 13:12:47 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-19 13:12:47 +0100
commit771eab934943ecfd38e16eab39061d6c458deb6c (patch)
tree9798405dd80bda6600a3fce59730f14cc57b0ba9
parentea6abffa8a08d832feb759d359d5b935e3087cf7 (diff)
parent677ff32db12bcd1bca3a3df733d2478896d6df96 (diff)
downloadfocaccia-qemu-771eab934943ecfd38e16eab39061d6c458deb6c.tar.gz
focaccia-qemu-771eab934943ecfd38e16eab39061d6c458deb6c.zip
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180719' into staging
don't segfault when trying to baseline an odd cpu model

# gpg: Signature made Thu 19 Jul 2018 12:39:05 BST
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20180719:
  s390x/cpumodel: fix segmentation fault when baselining models

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--target/s390x/cpu_models.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index cfdbccf46d..604898a882 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -716,6 +716,14 @@ CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *infoa,
 
     model.def = s390_find_cpu_def(cpu_type, max_gen, max_gen_ga,
                                   model.features);
+
+    /* models without early base features (esan3) are bad */
+    if (!model.def) {
+        error_setg(errp, "No compatible CPU model could be created as"
+                   " important base features are disabled");
+        return NULL;
+    }
+
     /* strip off features not part of the max model */
     bitmap_and(model.features, model.features, model.def->full_feat,
                S390_FEAT_MAX);