From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGlJZ-0005Jn-Od for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:18:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGlJQ-0001ZI-On for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:18:33 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:60357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGlJQ-0001Z7-HM for qemu-devel@nongnu.org; Fri, 21 Feb 2014 03:18:24 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Feb 2014 01:18:24 -0700 From: Michael Roth Date: Fri, 21 Feb 2014 02:16:57 -0600 Message-Id: <1392970647-21528-22-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1392970647-21528-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1392970647-21528-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 21/51] qdev-monitor: Avoid device_add crashing on non-device driver name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: lersek@redhat.com, qemu-stable@nongnu.org, Petar.Jovanovic@imgtec.com From: Markus Armbruster 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 (cherry picked from commit 061e84f7a469ad1f94f3b5f6a5361b346ab990e8) Signed-off-by: Michael Roth --- qdev-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) } } - if (!oc) { + if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) { qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type"); return NULL; } -- 1.7.9.5