From: Markus Armbruster Date: Thu, 28 Nov 2013 16:02:24 +0000 (+0100) Subject: qdev-monitor: Avoid device_add crashing on non-device driver name X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~1147^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=061e84f7a469ad1f94f3b5f6a5361b346ab990e8;p=sdk%2Femulator%2Fqemu.git qdev-monitor: Avoid device_add crashing on non-device driver name Watch this: $ 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) Crashes because "rng-egd" exists, but isn't a subtype of TYPE_DEVICE. Broken in commit 18b6dad. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster Signed-off-by: Andreas Färber --- diff --git a/qdev-monitor.c b/qdev-monitor.c index 7877d01..177b849 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -478,7 +478,7 @@ DeviceState *qdev_device_add(QemuOpts *opts) } } - if (!oc) { + if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type"); return NULL; }