From nobody Sat Apr 27 20:23:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488490663249104.28843537446005; Thu, 2 Mar 2017 13:37:43 -0800 (PST) Received: from localhost ([::1]:54766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjYPu-00034n-6i for importer@patchew.org; Thu, 02 Mar 2017 16:37:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjYPJ-00033B-AE for qemu-devel@nongnu.org; Thu, 02 Mar 2017 16:37:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjYPG-0006Ei-6o for qemu-devel@nongnu.org; Thu, 02 Mar 2017 16:37:05 -0500 Received: from mail-pg0-x235.google.com ([2607:f8b0:400e:c05::235]:35870) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjYPG-0006E5-0f for qemu-devel@nongnu.org; Thu, 02 Mar 2017 16:37:02 -0500 Received: by mail-pg0-x235.google.com with SMTP id s67so36230235pgb.3 for ; Thu, 02 Mar 2017 13:37:01 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id q7sm18842878pfb.98.2017.03.02.13.36.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 02 Mar 2017 13:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id; bh=k7dbt7jbBM7U6J7/q1F/wzVcJuVuHb4Jz/U7HoKvitY=; b=ZtXBSVdSThfIAU6ZAgd15CEWfT0/bXkfOoWgpQZ10MLMM1fOv0jVCvYHgQjURtZ4p0 zXh6b5RWefuFV77bvRn4UqWpAXuwLiaC2WnF1dpqi0zqYnsmG9p6t3FBfrs/b6nyBTkz uj+Xs4vfr0Y/YtJW9jOf55Q30i8RDOCAv3k00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k7dbt7jbBM7U6J7/q1F/wzVcJuVuHb4Jz/U7HoKvitY=; b=Ju/9YwTYsxpxJvXQU6S367f7eg7JzvRt8GkN6RuVifQmIli2jHW2kvg3Y6My3tR5m7 HLMhTcILAu+IeGYgX5LeZBza+OCHza0q6v+lfjSgB7l/CgiivCXWT2BONPnJ9btA2cgO eFrOcaaI+ycfFDKGdWPDS6YjlQmdqCRaMmMHC6LLeCwcDxI5k1njDHOiUhi1+nPYJJoh ZUS/m9xtGRyXr/nVV8JJJZA0AQgfjTn2Bedxlb1sPDlmq/acG2L2KgWcosP5aSRFtwny N0QuDMK473FM0A6en00HFIxggdOoFw+Y5Sj7B/WiPPERuDL7sK6nBRlRQyLgXtqGN3fY 82yw== X-Gm-Message-State: AMke39lN+eSI80GA44CxgnbCK1BHAx9dJrfjRWewgiuNqdjm9aEtfCl2uUPu2I4yNTKH8b5J X-Received: by 10.99.247.83 with SMTP id f19mr17838169pgk.158.1488490620969; Thu, 02 Mar 2017 13:37:00 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Thu, 2 Mar 2017 13:36:50 -0800 Message-Id: <20170302213650.86211-1-ben@skyportsystems.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::235 Subject: [Qemu-devel] [PATCH] Bugfix: Handle error if VM Generation ID device not present 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: , Cc: peter.maydell@linaro.org, Ben Warren , mst@redhat.com, armbru@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, imammedo@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ben Warren This was crashing due to NULL-pointer dereference QMP Test case: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (QEMU) query-vm-generation-id {"error": {"class": "GenericError", "desc": "VM Generation ID device not found"}} HMP Test case: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D virsh # qemu-monitor-command --hmp 3 info vm-generation-id VM Generation ID device not found Signed-off-by: Ben Warren Reviewed-by: Eric Blake Reviewed-by: Laszlo Ersek --- hmp.c | 4 +++- hw/acpi/vmgenid.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index 261843f..edb8970 100644 --- a/hmp.c +++ b/hmp.c @@ -2608,9 +2608,11 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict= *qdict) =20 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict) { - GuidInfo *info =3D qmp_query_vm_generation_id(NULL); + Error *err =3D NULL; + GuidInfo *info =3D qmp_query_vm_generation_id(&err); if (info) { monitor_printf(mon, "%s\n", info->guid); } + hmp_handle_error(mon, &err); qapi_free_GuidInfo(info); } diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 744f284..7a3ad17 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -248,6 +248,7 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp) Object *obj =3D find_vmgenid_dev(); =20 if (!obj) { + error_setg(errp, "VM Generation ID device not found"); return NULL; } vms =3D VMGENID(obj); --=20 2.7.4