hw/arm/highbank: Don't segfault on unknown CPU names
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 4 Apr 2014 16:42:33 +0000 (17:42 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 4 Apr 2014 16:46:11 +0000 (17:46 +0100)
If the user passes an unknown CPU name via the '-cpu' option, exit
with an error message rather than segfaulting.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Rob Herring <rob.herring@linaro.org>
hw/arm/highbank.c

index f66d57b113396890d2afd66819be87029d1eb2d5..2a88b843e9624fa51027c1dbec8c6d933cb6284a 100644 (file)
@@ -233,6 +233,11 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)
         ARMCPU *cpu;
         Error *err = NULL;
 
+        if (!oc) {
+            error_report("Unable to find CPU definition");
+            exit(1);
+        }
+
         cpu = ARM_CPU(object_new(object_class_get_name(oc)));
 
         object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar",