On 01/05/2016 07:06 AM, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <ebl...@redhat.com> wrote:
>> C compilers are allowed to represent enums as a smaller type
>> than int, if all enum values fit in the smaller type.  There
>> are even compiler flags that force the use of this smaller
>> representation, and using them changes the ABI of a binary.
>> Therefore, our generated code for visit_type_ENUM() (for all
>> qapi enums) was wrong for casting Enum* to int* when calling
>> visit_type_enum().
>>
>> It appears that no one has been doing this for qemu, because
>> if they had, we are potentially dereferencing beyond bounds
>> or even risking a SIGBUS on platforms where unaligned pointer
>> dereferencing is fatal.  Better is to avoid the practice
>> entirely, and just use the correct types.
>>
>> This matches the fix for alternate qapi types, done earlier in
>> "qapi: Simplify visiting of alternate types".

When I first wrote this commit message, commit 0426d53 wasn't yet in
mainline. Maintainer can touch up the message to call out the id, if
desired.

>>
>> Signed-off-by: Eric Blake <ebl...@redhat.com>
> 
> Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> 
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to