Bug 838928 - bad cast, not 64-bit clean, dict_allocate_and_serialize()
Summary: bad cast, not 64-bit clean, dict_allocate_and_serialize()
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Amar Tumballi
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-10 13:05 UTC by Kaleb KEITHLEY
Modified: 2013-12-19 00:08 UTC (History)
2 users (show)

Fixed In Version: glusterfs-3.4.0
Clone Of:
Environment:
Last Closed: 2013-07-24 17:19:32 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Kaleb KEITHLEY 2012-07-10 13:05:38 UTC
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:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Found by xinfeng.liu, email on gluster-devel mailing list

Comment 1 Kaleb KEITHLEY 2012-07-10 13:32:22 UTC
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().

Comment 2 Vijay Bellur 2012-07-12 07:31:56 UTC
CHANGE: http://review.gluster.com/3642 (calls to dict_allocate_and_serialize() are not 64-bit clean) merged in master by Anand Avati (avati)


Note You need to log in before you can comment on or make changes to this bug.