All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Kenny <darren.kenny@oracle.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH-for-6.2] qom/object: Ignore global properties with empty name
Date: Mon, 22 Nov 2021 11:19:01 +0000	[thread overview]
Message-ID: <m25yskigka.fsf@oracle.com> (raw)
In-Reply-To: <20211119113229.350338-1-philmd@redhat.com>

On Friday, 2021-11-19 at 12:32:29 +01, Philippe Mathieu-Daudé wrote:
> When using -global, properties might have empty name/value.
>
> This fixes this legitimate use case:
>
>   $ qemu-system-x86_64 -global driver=isa-fdc
>   qemu-system-x86_64: ../../devel/qemu/qapi/string-input-visitor.c:394:
>   string_input_visitor_new: Assertion `str' failed.
>   Aborted (core dumped)
>
>   (gdb) bt
>   #4  0x0000555555f6b8d5 in string_input_visitor_new (str=0x0) at qapi/string-input-visitor.c:394
>   #5  0x0000555555dd0f8d in object_property_parse (obj=0x555556f33400, name=0x0, string=0x0, errp=0x7fffffffc9c8) at qom/object.c:1641
>   #6  0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
>   #7  0x0000555555dc5ee2 in qdev_prop_set_globals (dev=0x555556f33400) at hw/core/qdev-properties.c:790
>   #8  0x0000555555dc89e8 in device_post_init (obj=0x555556f33400) at hw/core/qdev.c:697
>   #9  0x0000555555dce02b in object_post_init_with_type (obj=0x555556f33400, ti=0x55555672bd20) at qom/object.c:383
>   #10 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566e9090) at qom/object.c:387
>   #11 0x0000555555dce059 in object_post_init_with_type (obj=0x555556f33400, ti=0x5555566df730) at qom/object.c:387
>   #12 0x0000555555dce566 in object_initialize_with_type (obj=0x555556f33400, size=848, type=0x5555566df730) at qom/object.c:519
>   #13 0x0000555555dcec78 in object_new_with_type (type=0x5555566df730) at qom/object.c:733
>   #14 0x0000555555dceccf in object_new (typename=0x5555560fcf81 "isa-fdc") at qom/object.c:748
>   #15 0x0000555555dc75fe in qdev_new (name=0x5555560fcf81 "isa-fdc") at hw/core/qdev.c:153
>   #16 0x00005555559eec58 in isa_new (name=0x5555560fcf81 "isa-fdc") at hw/isa/isa-bus.c:166
>   #17 0x0000555555bd3607 in pc_superio_init (isa_bus=0x5555566b42e0, create_fdctrl=true, no_vmport=false) at hw/i386/pc.c:1026
>   (gdb) fr 6
>   #6  0x0000555555dce131 in object_apply_global_props (obj=0x555556f33400, props=0x555556737360, errp=0x555556611760 <error_fatal>) at qom/object.c:411
>   411             if (!object_property_parse(obj, p->property, p->value, &err)) {
>   (gdb) p *p
>   $1 = {driver = 0x555556738250 "isa-fdc", property = 0x0, value = 0x0, used = true, optional = false}
>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/604
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

> ---
>  qom/object.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/qom/object.c b/qom/object.c
> index 4f0677cca9e..45fa8561df6 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -401,6 +401,9 @@ bool object_apply_global_props(Object *obj, const GPtrArray *props,
>          GlobalProperty *p = g_ptr_array_index(props, i);
>          Error *err = NULL;
>  
> +        if (!p->property) {
> +            continue;
> +        }
>          if (object_dynamic_cast(obj, p->driver) == NULL) {
>              continue;
>          }
> -- 
> 2.31.1


  reply	other threads:[~2021-11-22 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 11:32 [PATCH-for-6.2] qom/object: Ignore global properties with empty name Philippe Mathieu-Daudé
2021-11-22 11:19 ` Darren Kenny [this message]
2021-11-24  8:46 ` 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=m25yskigka.fsf@oracle.com \
    --to=darren.kenny@oracle.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.