qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: "Eric Blake" <eblake@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Don Slutz <dslutz@verizon.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.1 2/2] qdev: Fix crash when using non-device class name on -global
Date: Thu, 03 Jul 2014 17:42:45 -0400	[thread overview]
Message-ID: <53B5CE55.1010202@terremark.com> (raw)
In-Reply-To: <53B5BC36.2030507@redhat.com>

On 07/03/14 16:25, Eric Blake wrote:
> On 07/03/2014 01:45 PM, Eduardo Habkost 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
> s/clas/class/
>
>> 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);
> I'm not an expert on the type system, but this one looks simple enough
> that I don't mind:
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>

Looks good to me also, and it passes my quick tests.

Tested-by: Don Slutz <dslutz@verizon.com>

    -Don Slutz

  reply	other threads:[~2014-07-03 21:43 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 [this message]
2014-07-07  6:41   ` Igor Mammedov

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=53B5CE55.1010202@terremark.com \
    --to=dslutz@verizon.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@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).