diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2012-07-10 09:33:02 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-12 00:31:47 -0700 |
commit | 08745892b4edd34296bfa5f2f4967329515346fb (patch) | |
tree | cfd16d52302b31aad2c9ce669fcb56dae1a3d9b3 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | |
parent | c76b49047aa396c0296a6ba2120e14abc0d27491 (diff) |
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 &<u_int>; 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 <kkeithle@redhat.com>
BUG: 838928
Reviewed-on: http://review.gluster.com/3642
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index cbe4c05dadd..774d067b533 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -167,7 +167,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, if (ctx) { ret = dict_allocate_and_serialize (ctx, &rsp.dict.dict_val, - (size_t*)&rsp.dict.dict_len); + &rsp.dict.dict_len); if (ret < 0 ) gf_log (THIS->name, GF_LOG_ERROR, "failed to " "serialize buffer"); @@ -1512,7 +1512,7 @@ glusterd3_1_friend_add (call_frame_t *frame, xlator_t *this, req.port = peerinfo->port; ret = dict_allocate_and_serialize (vols, &req.vols.vols_val, - (size_t *)&req.vols.vols_len); + &req.vols.vols_len); if (ret) goto out; @@ -1577,8 +1577,6 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, int ret = 0; glusterd_conf_t *priv = NULL; dict_t *friends = NULL; - char *dict_buf = NULL; - size_t len = -1; call_frame_t *dummy_frame = NULL; glusterd_peerinfo_t *peerinfo = NULL; @@ -1593,13 +1591,11 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, if (ret) goto out; - ret = dict_allocate_and_serialize (friends, &dict_buf, (size_t *)&len); + ret = dict_allocate_and_serialize (friends, &req.friends.friends_val, + &req.friends.friends_len); if (ret) goto out; - req.friends.friends_val = dict_buf; - req.friends.friends_len = len; - uuid_copy (req.uuid, MY_UUID); dummy_frame = create_frame (this, this->ctx->pool); @@ -1717,7 +1713,7 @@ glusterd3_1_stage_op (call_frame_t *frame, xlator_t *this, req.op = glusterd_op_get_op (); ret = dict_allocate_and_serialize (dict, &req.buf.buf_val, - (size_t *)&req.buf.buf_len); + &req.buf.buf_len); if (ret) goto out; @@ -1771,7 +1767,7 @@ glusterd3_1_commit_op (call_frame_t *frame, xlator_t *this, req.op = glusterd_op_get_op (); ret = dict_allocate_and_serialize (dict, &req.buf.buf_val, - (size_t *)&req.buf.buf_len); + &req.buf.buf_len); if (ret) goto out; |