From 3b418d0c45fccd850f9ad9eb4bf9bdcd96b8e6f7 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 4 Apr 2014 17:42:33 +0100 Subject: [PATCH] hw/arm/highbank: Don't segfault on unknown CPU names 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 Reviewed-by: Rob Herring --- hw/arm/highbank.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index f66d57b113..2a88b843e9 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -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", -- 2.11.4.GIT