Re: [PATCH 1/2] virdbus: don't force users to pass int for bool values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/20/2014 04:17 PM, Eric Blake wrote:
> On 11/20/2014 08:12 AM, Conrad Meyer wrote:
>> Hi Eric,
>>
>> I think this change breaks build on FreeBSD:
>>
>>   CC       util/libvirt_util_la-virdbus.lo
>> util/virdbus.c:956:13: error: cast from 'bool *' to 'dbus_bool_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
>>             GET_NEXT_VAL(dbus_bool_t, bool_val, bool, "%d");
>>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> util/virdbus.c:858:17: note: expanded from macro 'GET_NEXT_VAL'
>>             x = (dbustype *)(*xptrptr + (*narrayptr - 1));              \
>>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
> 
> Valid complaint, so I'll have to figure something out to avoid it.  :(
> Thanks for the heads up.

Thanks again for flagging this!

We had a pre-existing bug.  Even something like "a&n" was broken on
encoding, because even though type 'n' (int16_t) promotes to a full
'int' when parsed via varargs, passing an array of shorts and then
dereferencing it via (int*) will read beyond array bounds.  We had a
hole in our testsuite for never testing arrayref with sub-int types,
even before my commit added 'bool *' to the list of sub-int types that
we now need to support.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]