qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: armbru@redhat.com, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, aliguori@amazon.com
Subject: Re: [Qemu-devel] [PATCH] qdev-monitor: device_add crashes on non-device driver name, fix
Date: Thu, 28 Nov 2013 17:11:18 +0100	[thread overview]
Message-ID: <52976B26.1030501@suse.de> (raw)
In-Reply-To: <1385654544-1774-1-git-send-email-armbru@redhat.com>

Am 28.11.2013 17:02, schrieb armbru@redhat.com:
> From: Markus Armbruster <armbru@redhat.com>
> 
> 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.

Thanks for catching this!

> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  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)) {

Are you sure we don't need !oc || !object_class_dynamic_cast(oc, ...)?

Regards,
Andreas

>          qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
>          return NULL;
>      }
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2013-11-28 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 16:02 [Qemu-devel] [PATCH] qdev-monitor: device_add crashes on non-device driver name, fix armbru
2013-11-28 16:11 ` Andreas Färber [this message]
2013-11-28 16:19   ` Markus Armbruster
2013-12-18 14:54 ` Markus Armbruster
2013-12-18 15:50   ` Andreas Färber
2013-12-18 17:06     ` Markus Armbruster

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=52976B26.1030501@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=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).