Received: from eggs.gnu.org ([2001:4830:134:3::10]:35760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVi8E-00025P-7e for qemu-devel@nongnu.org; Thu, 03 Apr 2014 09:56:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVi8C-00084Q-5P for qemu-devel@nongnu.org; Thu, 03 Apr 2014 09:56:38 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:47465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVi8B-00082n-VV for qemu-devel@nongnu.org; Thu, 03 Apr 2014 09:56:36 -0400 From: Peter Maydell Date: Thu, 3 Apr 2014 14:56:27 +0100 Message-Id: <1396533388-12069-2-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1396533388-12069-1-git-send-email-peter.maydell@linaro.org> References: <1396533388-12069-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [for-2.0 1/2] hw/arm/highbank: Don't segfault on unknown CPU names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Rob Herring , patches@linaro.org 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 --- hw/arm/highbank.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index f66d57b..03545aa 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) { + fprintf(stderr, "Unable to find CPU definition\n"); + exit(1); + } + cpu = ARM_CPU(object_new(object_class_get_name(oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", -- 1.9.0