Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Gerd Hoffmann
Hi, >> What are the uses of null in qdev string properties? I know you can't >> set a string to null since parse() doesn't have a null syntax. So we're >> really just talking about an uninitialized state, right? > > Yes. No ROM BAR is an example of a NULL string property. Both NULL and zero

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 04:54 PM, Anthony Liguori wrote: On 12/16/2011 09:42 AM, Paolo Bonzini wrote: On 12/16/2011 04:23 PM, Anthony Liguori wrote: Ok. I think nullable strings are not a good idea simply because it means that a property can have a state that cannot be set. How is this different from N

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 09:42 AM, Paolo Bonzini wrote: On 12/16/2011 04:23 PM, Anthony Liguori wrote: Ok. I think nullable strings are not a good idea simply because it means that a property can have a state that cannot be set. How is this different from NULL links? (Honest, not trick question :)). An

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 04:23 PM, Anthony Liguori wrote: Ok. I think nullable strings are not a good idea simply because it means that a property can have a state that cannot be set. How is this different from NULL links? (Honest, not trick question :)). Long term, I want to be able to do something l

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 09:13 AM, Paolo Bonzini wrote: On 12/16/2011 04:05 PM, Anthony Liguori wrote: What are the uses of null in qdev string properties? I know you can't set a string to null since parse() doesn't have a null syntax. So we're really just talking about an uninitialized state, right?

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 04:05 PM, Anthony Liguori wrote: What are the uses of null in qdev string properties? I know you can't set a string to null since parse() doesn't have a null syntax. So we're really just talking about an uninitialized state, right? Yes. No ROM BAR is an example of a NULL string

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 09:03 AM, Paolo Bonzini wrote: On 12/16/2011 03:56 PM, Anthony Liguori wrote: I'd really prefer to stick to non-nullable strings as there is no obvious way to specify NULL in command line options. We can leave it as the default. A property with a non-null default is implicitly no

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 03:56 PM, Anthony Liguori wrote: I'd really prefer to stick to non-nullable strings as there is no obvious way to specify NULL in command line options. We can leave it as the default. A property with a non-null default is implicitly not nullable, which actually makes some sense.

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 08:49 AM, Paolo Bonzini wrote: On 12/16/2011 03:46 PM, Anthony Liguori wrote: Hmm, then we have to introduce NULL into QJson and visitors. Visitors assume that strings aren't nullable (which is actually true in JSON and in QString). I also think that string properties shouldn't

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 03:46 PM, Anthony Liguori wrote: Hmm, then we have to introduce NULL into QJson and visitors. Visitors assume that strings aren't nullable (which is actually true in JSON and in QString). I also think that string properties shouldn't be nullable. Unfortunately, qdev string pro

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 08:22 AM, Paolo Bonzini wrote: On 12/16/2011 03:10 PM, Anthony Liguori wrote: If a property function does not set the Error pointer, it must visit something. Hmm, then we have to introduce NULL into QJson and visitors. Visitors assume that strings aren't nullable (which is actu

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 03:10 PM, Anthony Liguori wrote: If a property function does not set the Error pointer, it must visit something. Hmm, then we have to introduce NULL into QJson and visitors. Paolo

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 08:00 AM, Paolo Bonzini wrote: On 12/16/2011 02:55 PM, Anthony Liguori wrote: This is visible with qom-get path=/i440fx/piix3 property=romfile after static non-string properties are introduced. I'm a bit confused about what's happening here. What's the significance of non-strin

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
On 12/16/2011 02:55 PM, Anthony Liguori wrote: This is visible with qom-get path=/i440fx/piix3 property=romfile after static non-string properties are introduced. I'm a bit confused about what's happening here. What's the significance of non-string properties? Should have been "static

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Anthony Liguori
On 12/16/2011 06:01 AM, Paolo Bonzini wrote: QAPI currently cannot deal with no object pushed to the stack, and dereferences a NULL pointer. This is visible with qom-get path=/i440fx/piix3 property=romfile after static non-string properties are introduced. I'm a bit confused about what'

[Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference

2011-12-16 Thread Paolo Bonzini
QAPI currently cannot deal with no object pushed to the stack, and dereferences a NULL pointer. This is visible with qom-get path=/i440fx/piix3 property=romfile after static non-string properties are introduced. Signed-off-by: Paolo Bonzini --- qapi/qmp-output-visitor.c |4 ++-- 1 fil