Red Hat Bugzilla – Bug 838928
bad cast, not 64-bit clean, dict_allocate_and_serialize()
Last modified: 2013-12-18 19:08:18 EST
Description of problem:
All calls to dict_allocate_and_serialize() pass the address of a 32-bit type, but cast it to a 64-bit pointer type (size_t *). This happens to work on LE machines, but even if it's benign, it's still a bug. On BE machines it is not benign.
Version-Release number of selected component (if applicable): All.
How reproducible: build/run on a BE machine, e.g. SPARC or PPC
Steps to Reproduce:
Found by firstname.lastname@example.org, email on email@example.com mailing list
In every call to dict_allocate_and_serialize(), the underlying 'len' param is always a u_int, so:
a) why is the param a size_t* ?
b) and then why have extra code in GF_PROTOCOL_DICT_SERIALIZE to work around it?
By changing the param in dict_allocate_and_serialize() to a u_int* we only need to fix a few files and then we have 64-bit clean code everywhere we call dict_allocate_and_serialize().
CHANGE: http://review.gluster.com/3642 (calls to dict_allocate_and_serialize() are not 64-bit clean) merged in master by Anand Avati (firstname.lastname@example.org)