From patchwork Thu Jan 25 13:43:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 125837 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1123362ljf; Thu, 25 Jan 2018 05:47:49 -0800 (PST) X-Google-Smtp-Source: AH8x227t4KUGpqAx7zy6r31N1XSsF7jFMFedZdk915qqG3QTfeD47VWB5Q3VhNGV7Zi7UMhJHiLk X-Received: by 10.37.144.11 with SMTP id s11mr8361530ybl.354.1516888069573; Thu, 25 Jan 2018 05:47:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516888069; cv=none; d=google.com; s=arc-20160816; b=f5mQjjvWk5q5jIk6ZF4V4gSa8ZkRmQj/q8tjcKYRhuuRhqblmgsnqD/xmLVI7qrbGC hA1kEnPeBDBDDtjc/wO7q4ZCLIrMK7obpfrQX+0Y+ecFxHwWi8NZQO0vDEn6Njc6F6Ds kcTgHCMRy5kwMWla+TaVZf6UQCQcih4adOnpQjWzR4J0wrmSVOhLN40VEFMkxjf2TxOK F/tcrR5ON+q68RLBFlTbMhF2c5E0w0KA3RTP+qCa5dPWpbpQW88UeMiPhCiUCeErEgZk u5wB1OW9sYt5joJKH3N7qminT89JNTxsBj9tXTko9q+jDWPog82guW24Xfu1g9CJq6ds e1Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=bZNF2aH6o5CKc4d+MmvC15G7JMbdGHlXuZGStqtKK2A=; b=V2FdZU+jEOnEJ2izlpIivJcZBRYdjiYMS4BiCd1wD6JU/e0lqKrwdRSKK6/H1IuAfo iJ0VgmMWOPG6vLum5fWy55skxDlMCUoqu+y/2f2LAjbCWdksgGZ35EH3ZYzsUA/b9t4P kDi9b04JhzK1brUhxiqr1tqyvNita9gpQ651T0bNdsFq/iI4OpsmrK7wubI2hCcKNllH fUI00QbTeaOuGEKvjPDVElBaS6TPfoU27IShSicSugsvkYCZ3bfpXfDg9LuKfMKgmGCG IxMY3JAtj89ZBGtH3AKghQbPusewMt0xSt5eK0p8vgbs9NLUXZKM8eUHkA8jUNx5ytSG +14w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 186si1382214ybh.240.2018.01.25.05.47.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 25 Jan 2018 05:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41399 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eehsb-0006Gu-0O for patch@linaro.org; Thu, 25 Jan 2018 08:47:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eehok-0003Jm-Vb for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eehok-0003C0-6H for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:51 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:45994) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eehoj-0003BN-Vn for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:50 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eehoi-0006xO-Bp for qemu-devel@nongnu.org; Thu, 25 Jan 2018 13:43:48 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 25 Jan 2018 13:43:26 +0000 Message-Id: <1516887809-6265-19-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516887809-6265-1-git-send-email-peter.maydell@linaro.org> References: <1516887809-6265-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 18/21] hw/arm/virt: Check that the CPU realize method succeeded X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We were passing a NULL error pointer to the object_property_set_bool() call that realizes the CPU object. This meant that we wouldn't detect failure, and would plough blindly on to crash later trying to use a NULL CPU object pointer. Detect errors and fail instead. In particular, this will be necessary to detect the user error of using "-cpu host" without "-enable-kvm" once we make the host CPU type be registered unconditionally rather than only in kvm_arch_init(). Signed-off-by: Peter Maydell --- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a4537af..b334c82 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1404,7 +1404,7 @@ static void machvirt_init(MachineState *machine) "secure-memory", &error_abort); } - object_property_set_bool(cpuobj, true, "realized", NULL); + object_property_set_bool(cpuobj, true, "realized", &error_fatal); object_unref(cpuobj); } fdt_add_timer_nodes(vms);