Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-11 Thread Michael Roth
Quoting Paolo Bonzini (2014-09-11 09:35:58) > Il 11/09/2014 16:26, Michael Roth ha scritto: > > Also, the .kind field of a QAPI Union type is something we generate for use > > by the generated visitor code. In the case of an unspecified discriminator > > we generated the enum type for that field in

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-11 Thread Paolo Bonzini
Il 11/09/2014 16:26, Michael Roth ha scritto: > Also, the .kind field of a QAPI Union type is something we generate for use > by the generated visitor code. In the case of an unspecified discriminator > we generated the enum type for that field internally. In the case where it's > specified, we use

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-11 Thread Michael Roth
Quoting Fam Zheng (2014-09-10 23:38:03) > On Wed, 09/10 22:17, Eric Blake wrote: > > On 09/10/2014 06:53 PM, Fam Zheng wrote: > > > On Wed, 09/10 17:32, Paolo Bonzini wrote: > > >> Il 10/09/2014 17:02, Fam Zheng ha scritto: > > A bit hackish, but I don't have any better idea. > > > >

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Fam Zheng
On Wed, 09/10 22:17, Eric Blake wrote: > On 09/10/2014 06:53 PM, Fam Zheng wrote: > > On Wed, 09/10 17:32, Paolo Bonzini wrote: > >> Il 10/09/2014 17:02, Fam Zheng ha scritto: > A bit hackish, but I don't have any better idea. > > Hmm... what about adding a new member to the visitors

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Eric Blake
On 09/10/2014 06:53 PM, Fam Zheng wrote: > On Wed, 09/10 17:32, Paolo Bonzini wrote: >> Il 10/09/2014 17:02, Fam Zheng ha scritto: A bit hackish, but I don't have any better idea. Hmm... what about adding a new member to the visitors for "invalid enum" value? The dealloc visito

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Michael Roth
Quoting Fam Zheng (2014-09-10 07:30:39) > We shouldn't do anything in the switch block in enum's visit_type_ > function, when the enum data's ->kind is not valid at all. This happens > when the dealloc visitor is called, after qmp input visitor returned > error. Comment is kind of confusing. Enum

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Fam Zheng
On Wed, 09/10 17:32, Paolo Bonzini wrote: > Il 10/09/2014 17:02, Fam Zheng ha scritto: > > > A bit hackish, but I don't have any better idea. > > > > > > Hmm... what about adding a new member to the visitors for "invalid enum" > > > value? The dealloc visitor could override it to do nothing, whil

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Paolo Bonzini
Il 10/09/2014 17:02, Fam Zheng ha scritto: > > A bit hackish, but I don't have any better idea. > > > > Hmm... what about adding a new member to the visitors for "invalid enum" > > value? The dealloc visitor could override it to do nothing, while the > > default could abort or set an error. Woul

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Fam Zheng
On Wed, 09/10 15:01, Paolo Bonzini wrote: > Il 10/09/2014 14:30, Fam Zheng ha scritto: > > We shouldn't do anything in the switch block in enum's visit_type_ > > function, when the enum data's ->kind is not valid at all. This happens > > when the dealloc visitor is called, after qmp input visitor r

Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Paolo Bonzini
Il 10/09/2014 14:30, Fam Zheng ha scritto: > We shouldn't do anything in the switch block in enum's visit_type_ > function, when the enum data's ->kind is not valid at all. This happens > when the dealloc visitor is called, after qmp input visitor returned > error. > > Now, the input visitor will

[Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid

2014-09-10 Thread Fam Zheng
We shouldn't do anything in the switch block in enum's visit_type_ function, when the enum data's ->kind is not valid at all. This happens when the dealloc visitor is called, after qmp input visitor returned error. Now, the input visitor will set ->kind to _MAX if the value is not found, so that i