qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, "Don Slutz" <dslutz@verizon.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global
Date: Mon, 7 Jul 2014 08:41:48 +0200	[thread overview]
Message-ID: <20140707084148.702be087@nial.usersys.redhat.com> (raw)
In-Reply-To: <1404416735-22371-3-git-send-email-ehabkost@redhat.com>

On Thu,  3 Jul 2014 16:45:35 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:

> This fixes the following crash:
> 
>     $ qemu-system-x86_64 -global container.xxx=y
>     hw/core/qdev-properties-system.c:399:qdev_add_one_global: Object 0x7f7eff234100 is not an instance of type device
>     Aborted (core dumped)
> 
> New behavior will be to just warn, just like when non-existing clas
> names are used:
> 
>     $ qemu-system-x86_64 -global container.xxx=y
>     qemu-system-x86_64: Warning: "-global container.xxx=y" not used
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  hw/core/qdev-properties-system.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> index 8e140af..ae0900f 100644
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -394,7 +394,8 @@ static int qdev_add_one_global(QemuOpts *opts, void *opaque)
>      g->driver   = qemu_opt_get(opts, "driver");
>      g->property = qemu_opt_get(opts, "property");
>      g->value    = qemu_opt_get(opts, "value");
> -    oc = object_class_by_name(g->driver);
> +    oc = object_class_dynamic_cast(object_class_by_name(g->driver),
> +                                   TYPE_DEVICE);
>      if (oc) {
>          DeviceClass *dc = DEVICE_CLASS(oc);
>  

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

      parent reply	other threads:[~2014-07-07  6:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 19:45 [Qemu-devel] [PATCH for-2.1 0/2] Fix crashes related to -global option Eduardo Habkost
2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 1/2] qdev: Don't abort() in case globals can't be set Eduardo Habkost
2014-07-03 19:45 ` [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global Eduardo Habkost
2014-07-03 20:25   ` Eric Blake
2014-07-03 21:42     ` Don Slutz
2014-07-07  6:41   ` Igor Mammedov [this message]

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=20140707084148.702be087@nial.usersys.redhat.com \
    --to=imammedo@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=dslutz@verizon.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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).