From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgxRd-0004PH-3X for qemu-devel@nongnu.org; Tue, 29 Sep 2015 12:07:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgxRZ-0001ye-Kk for qemu-devel@nongnu.org; Tue, 29 Sep 2015 12:07:57 -0400 References: <1443470907-32335-1-git-send-email-armbru@redhat.com> <1443470907-32335-6-git-send-email-armbru@redhat.com> <560A349A.5090506@redhat.com> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <560AB758.7040905@suse.de> Date: Tue, 29 Sep 2015 18:07:52 +0200 MIME-Version: 1.0 In-Reply-To: <560A349A.5090506@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 5/7] qmp: Fix device-list-properties not to crash for abstract device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: ehabkost@redhat.com, Thomas Huth , qemu-devel@nongnu.org, stefanha@redhat.com, qemu-stable@nongnu.org Am 29.09.2015 um 08:50 schrieb Thomas Huth: > On 28/09/15 22:08, Markus Armbruster wrote: >> Broken in commit f4eb32b "qmp: show QOM properties in >> device-list-properties", v2.1. >> >> Cc: qemu-stable@nongnu.org >> Signed-off-by: Markus Armbruster >> Reviewed-by: Eric Blake >> --- >> 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_propertie= s(const char *typename, >> return NULL; >> } >> =20 >> + if (object_class_is_abstract(klass)) { >> + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name", >> + "non-abstract device type"); >> + return NULL; >> + } >> + >> obj =3D object_new(typename); >> =20 >> QTAILQ_FOREACH(prop, &obj->properties, node) { >> diff --git a/tests/device-introspect-test.c b/tests/device-introspect-= test.c >> index 832b60a..a8950a1 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; >> =20 >> - /* >> - * 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 =3D qmp("{'execute': 'device-list-properties'," >> - " 'arguments': {'typename': %s}}", >> - type); >> - QDECREF(resp); >> - } >> + resp =3D qmp("{'execute': 'device-list-properties'," >> + " 'arguments': {'typename': %s}}", >> + type); >> + QDECREF(resp); >> =20 >> help =3D hmp("device_add \"%s,help\"", type); >> g_free(help); >> >=20 > Why don't you fix this before patch 4/7, then you don't have to add the > temporary work-around in device-introspect-test.c ? +1, but anyway: Reviewed-by: Andreas F=C3=A4rber Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N= =C3=BCrnberg)