qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: [Qemu-devel] [PULL v2 09/11] qmp: Fix device-list-properties not to crash for abstract device
Date: Thu,  8 Oct 2015 15:02:09 +0200	[thread overview]
Message-ID: <1444309331-17927-10-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1444309331-17927-1-git-send-email-armbru@redhat.com>

Broken in commit f4eb32b "qmp: show QOM properties in
device-list-properties", v2.1.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-Id: <1443689999-12182-9-git-send-email-armbru@redhat.com>
---
 qmp.c                          |  6 ++++++
 tests/device-introspect-test.c | 15 ++++-----------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/qmp.c b/qmp.c
index 057a7cb..1413de4 100644
--- a/qmp.c
+++ b/qmp.c
@@ -515,6 +515,12 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
         return NULL;
     }
 
+    if (object_class_is_abstract(klass)) {
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name",
+                   "non-abstract device type");
+        return NULL;
+    }
+
     obj = object_new(typename);
 
     QTAILQ_FOREACH(prop, &obj->properties, node) {
diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c
index f240b5c..8a27b4a 100644
--- a/tests/device-introspect-test.c
+++ b/tests/device-introspect-test.c
@@ -45,17 +45,10 @@ static void test_one_device(const char *type)
     QDict *resp;
     char *help, *qom_tree;
 
-    /*
-     * Skip this part for the abstract device test case, because
-     * device-list-properties crashes for such devices.
-     * FIXME fix it not to crash
-     */
-    if (strcmp(type, "device")) {
-        resp = qmp("{'execute': 'device-list-properties',"
-                   " 'arguments': {'typename': %s}}",
-                   type);
-        QDECREF(resp);
-    }
+    resp = qmp("{'execute': 'device-list-properties',"
+               " 'arguments': {'typename': %s}}",
+               type);
+    QDECREF(resp);
 
     help = hmp("device_add \"%s,help\"", type);
     g_free(help);
-- 
2.4.3

  parent reply	other threads:[~2015-10-08 13:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 13:02 [Qemu-devel] [PULL v2 00/11] Fix device introspection regressions Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 01/11] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 02/11] memory: allow destroying a non-empty MemoryRegion Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 03/11] hw: do not pass NULL to memory_region_init from instance_init Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 04/11] macio: move DBDMA_init from instance_init to realize Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 05/11] tests: Fix how qom-test is run Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 06/11] libqtest: Clean up unused QTestState member sigact_old Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 07/11] libqtest: New hmp() & friends Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 08/11] device-introspect-test: New, covering device introspection Markus Armbruster
2015-10-08 13:02 ` Markus Armbruster [this message]
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 10/11] qdev: Protect device-list-properties against broken devices Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 11/11] Revert "qdev: Use qdev_get_device_class() for -device <type>, help" Markus Armbruster
2015-10-08 14:33 ` [Qemu-devel] [PULL v2 00/11] Fix device introspection regressions Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444309331-17927-10-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).