From 08745892b4edd34296bfa5f2f4967329515346fb Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Tue, 10 Jul 2012 09:33:02 -0400 Subject: calls to dict_allocate_and_serialize() are not 64-bit clean All calls to dict_allocate_and_serialize() pass the address of a 32-bit type, but must cast it to the 64-bit pointer type (size_t *). This happens to work on LE machines, but even if it's apparently benign, it's still a bug. On BE machines it is not benign. GF_PROTOCOL_DICT_SERIALIZE() hacks around it by creating a size_t temp var, but that's, well, a hack, IMO when you consider that all the callers are actually passing &; the param should just be a u_int * and eliminate the buggy casts and the temp var in the macro. Nobody apparently uses the Fedora/EPEL PPC RPMs, but they might. People are trying to build gluster.org bits on SPARC and tripping over this. Change-Id: I92ea139f9e3e91ddbbb32a51b96fa582a9515626 Signed-off-by: Kaleb S. KEITHLEY BUG: 838928 Reviewed-on: http://review.gluster.com/3642 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-handler.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 63d53ef2a1e..51fa993e9e9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -929,7 +929,7 @@ glusterd_handle_cli_list_volume (rpcsvc_request_t *req) goto out; ret = dict_allocate_and_serialize (dict, &rsp.dict.dict_val, - (size_t *)&rsp.dict.dict_len); + &rsp.dict.dict_len); if (ret) goto out; @@ -1230,7 +1230,7 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret, rsp.op_errstr = op_errstr; if (rsp.op_ret == 0) ret = dict_allocate_and_serialize (dict, &rsp.fsm_log.fsm_log_val, - (size_t *)&rsp.fsm_log.fsm_log_len); + &rsp.fsm_log.fsm_log_len); ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf1_cli_fsm_log_rsp); @@ -1402,9 +1402,8 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req, else rsp.op_errstr = ""; - ret = dict_allocate_and_serialize (rsp_dict, - &rsp.dict.dict_val, - (size_t *)&rsp.dict.dict_len); + ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val, + &rsp.dict.dict_len); if (ret < 0) { gf_log ("", GF_LOG_DEBUG, "failed to get serialized length of dict"); @@ -1441,9 +1440,8 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req, rsp.op_errstr = ""; if (rsp_dict) { - ret = dict_allocate_and_serialize (rsp_dict, - &rsp.dict.dict_val, - (size_t *)&rsp.dict.dict_len); + ret = dict_allocate_and_serialize (rsp_dict, &rsp.dict.dict_val, + &rsp.dict.dict_len); if (ret < 0) { gf_log ("", GF_LOG_DEBUG, "failed to get serialized length of dict"); @@ -2475,7 +2473,7 @@ glusterd_list_friends (rpcsvc_request_t *req, dict_t *dict, int32_t flags) } ret = dict_allocate_and_serialize (friends, &rsp.friends.friends_val, - (size_t *)&rsp.friends.friends_len); + &rsp.friends.friends_len); if (ret) goto out; @@ -2582,7 +2580,7 @@ respond: if (ret) goto out; ret = dict_allocate_and_serialize (volumes, &rsp.dict.dict_val, - (size_t *)&rsp.dict.dict_len); + &rsp.dict.dict_len); if (ret) goto out; -- cgit