From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm4Jb-0001VO-5f for qemu-devel@nongnu.org; Thu, 28 Nov 2013 11:19:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm4JT-0000r1-4v for qemu-devel@nongnu.org; Thu, 28 Nov 2013 11:19:43 -0500 From: Markus Armbruster References: <1385654544-1774-1-git-send-email-armbru@redhat.com> <52976B26.1030501@suse.de> Date: Thu, 28 Nov 2013 17:19:30 +0100 In-Reply-To: <52976B26.1030501@suse.de> ("Andreas =?utf-8?Q?F=C3=A4rber=22?= =?utf-8?Q?'s?= message of "Thu, 28 Nov 2013 17:11:18 +0100") Message-ID: <8738mgebxp.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qdev-monitor: device_add crashes on non-device driver name, fix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: qemu-devel@nongnu.org, aliguori@amazon.com, qemu-stable@nongnu.org Andreas F=C3=A4rber writes: > Am 28.11.2013 17:02, schrieb armbru@redhat.com: >> From: Markus Armbruster >>=20 >> Watch this: >>=20 >> $ upstream-qemu -nodefaults -S -display none -monitor stdio >> QEMU 1.7.50 monitor - type 'help' for more information >> (qemu) device_add rng-egd >> /work/armbru/qemu/qdev-monitor.c:491:qdev_device_add: Object >> 0x2089b00 is not an instance of type device >> Aborted (core dumped) >>=20 >> Crashes because "rng-egd" exists, but isn't a subtype of TYPE_DEVICE. >> Broken in commit 18b6dad. > > Thanks for catching this! > >>=20 >> Cc: qemu-stable@nongnu.org >> Signed-off-by: Markus Armbruster >> --- >> qdev-monitor.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/qdev-monitor.c b/qdev-monitor.c >> index dc37a43..90a0cea 100644 >> --- a/qdev-monitor.c >> +++ b/qdev-monitor.c >> @@ -477,7 +477,7 @@ DeviceState *qdev_device_add(QemuOpts *opts) >> } >> } >>=20=20 >> - if (!oc) { >> + if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { > > Are you sure we don't need !oc || !object_class_dynamic_cast(oc, ...)? Yes. First thing object_class_dynamic_cast() does is if (!class) { return NULL; } Makes sense to me. [...]