[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid |
Date: |
Thu, 11 Sep 2014 16:35:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
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 an existing enum instead...
>
> But nothing stops us from generating a new "shadow" enum in this case as well,
> with the indexes/integer values of the corresponding strings shifted by one so
> we can reserve the 0 index for _INVALID. I think we can reasonably expect that
> nothing outside the generated code makes use of those integer values in this
> special case, and don't have to change all enum types to make that work.
But how would users fill in structs if you have to use a different enum?
What about making adding visit_start_union/visit_end_union?
visit_start_union can return false if the visit of the union has to be
skipped.
The dealloc visitor can skip it if the data field is NULL; everything
else can just use a default implementation which always returns true.
Paolo
- [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Fam Zheng, 2014/09/10
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Paolo Bonzini, 2014/09/10
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Fam Zheng, 2014/09/10
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Paolo Bonzini, 2014/09/10
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Fam Zheng, 2014/09/10
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Eric Blake, 2014/09/11
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Fam Zheng, 2014/09/11
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Michael Roth, 2014/09/11
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Michael Roth, 2014/09/11
Re: [Qemu-devel] [PATCH] qapi: Fix crash with enum dealloc when kind is invalid, Michael Roth, 2014/09/10
[Qemu-devel] [PATCH] tests: add QMP input visitor test for unions with no discriminator, Michael Roth, 2014/09/10