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 | |
| 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>
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 117 | ||||
| -rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 14 | ||||
| -rw-r--r-- | libglusterfs/src/dict.c | 2 | ||||
| -rw-r--r-- | libglusterfs/src/dict.h | 7 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 18 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 16 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 8 | 
8 files changed, 77 insertions, 109 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index a40fd482947..2933b08df92 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -2496,9 +2496,8 @@ gf_cli3_1_get_volume (call_frame_t *frame, xlator_t *this,                  goto out;          } -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          ret = cli_cmd_submit (&req, frame, cli_rpc_prog,                                GLUSTER_CLI_GET_VOLUME, NULL, @@ -2533,9 +2532,8 @@ gf_cli3_1_create_volume (call_frame_t *frame, xlator_t *this,          dict = dict_ref ((dict_t *)data); -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_DEBUG,                          "failed to get serialized length of dict"); @@ -2596,9 +2594,8 @@ gf_cli3_1_delete_volume (call_frame_t *frame, xlator_t *this,                  frame->local = local;          } -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to get serialize dict"); @@ -2637,9 +2634,8 @@ gf_cli3_1_start_volume (call_frame_t *frame, xlator_t *this,          dict = data;          local = cli_local_get (); -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize dict"); @@ -2685,9 +2681,8 @@ gf_cli3_1_stop_volume (call_frame_t *frame, xlator_t *this,                  frame->local = local;          } -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *) &req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -2788,9 +2783,8 @@ done:                  local = NULL;          } -        ret = dict_allocate_and_serialize (req_dict, -                                           &req.dict.dict_val, -                                           (size_t *) &req.dict.dict_len); +        ret = dict_allocate_and_serialize (req_dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -2827,9 +2821,8 @@ gf_cli3_1_rename_volume (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *) &req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -2864,9 +2857,8 @@ gf_cli3_1_reset_volume (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to get serialized length of dict"); @@ -2899,9 +2891,8 @@ gf_cli3_1_set_volume (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_DEBUG,                          "failed to get serialized length of dict"); @@ -2946,9 +2937,8 @@ gf_cli3_1_add_brick (call_frame_t *frame, xlator_t *this,                  goto out; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_DEBUG,                          "failed to get serialized length of dict"); @@ -3014,9 +3004,8 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,          if ((command != GF_OP_CMD_STATUS) &&              (command != GF_OP_CMD_STOP)) { -                ret = dict_allocate_and_serialize (dict, -                                                   &req.dict.dict_val, -                                                   (size_t *)&req.dict.dict_len); +                ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                                   &req.dict.dict_len);                  if (ret < 0) {                          gf_log (this->name, GF_LOG_DEBUG,                                  "failed to get serialized length of dict"); @@ -3054,9 +3043,8 @@ gf_cli3_1_remove_brick (call_frame_t *frame, xlator_t *this,                          goto out;                  } -                ret = dict_allocate_and_serialize (req_dict, -                                                   &status_req.dict.dict_val, -                                                   (size_t *) &status_req.dict.dict_len); +                ret = dict_allocate_and_serialize (req_dict, &status_req.dict.dict_val, +                                                   &status_req.dict.dict_len);                  if (ret < 0) {                          gf_log (this->name, GF_LOG_ERROR,                                  "failed to serialize the data"); @@ -3151,9 +3139,8 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this,                  dst_brick, op); -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_DEBUG,                          "failed to get serialized length of dict"); @@ -3191,9 +3178,8 @@ gf_cli3_1_log_rotate (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (THIS->name, GF_LOG_ERROR, "failed to serialize dict"); @@ -3228,9 +3214,8 @@ gf_cli3_1_sync_volume (call_frame_t *frame, xlator_t *this,          }          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (THIS->name, GF_LOG_ERROR, "failed to serialize dict"); @@ -3295,9 +3280,8 @@ gf_cli3_1_quota (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to get serialized length of dict"); @@ -3671,9 +3655,8 @@ gf_cli3_1_gsync_set (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *) &req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -4043,9 +4026,8 @@ gf_cli3_1_profile_volume (call_frame_t *frame, xlator_t *this, void *data)                  goto out;          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR, @@ -4320,9 +4302,8 @@ gf_cli3_1_top_volume (call_frame_t *frame, xlator_t *this, void *data)                  goto out;          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -5616,9 +5597,8 @@ gf_cli3_1_status_volume (call_frame_t *frame, xlator_t *this,          dict = data; -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log ("cli", GF_LOG_ERROR,                          "failed to serialize the data"); @@ -5772,7 +5752,7 @@ gf_cli3_1_mount (call_frame_t *frame, xlator_t *this, void *data)          req.label = label;          ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +                                           &req.dict.dict_len);          if (ret) {                  ret = -1;                  goto out; @@ -6051,9 +6031,8 @@ gf_cli3_1_heal_volume (call_frame_t *frame, xlator_t *this,                  frame->local = local;          } -        ret = dict_allocate_and_serialize (dict, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -6132,9 +6111,8 @@ gf_cli3_1_statedump_volume (call_frame_t *frame, xlator_t *this,          options = data; -        ret = dict_allocate_and_serialize (options, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (options, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log (this->name, GF_LOG_ERROR,                          "failed to serialize the data"); @@ -6334,9 +6312,8 @@ gf_cli3_1_clearlocks_volume (call_frame_t *frame, xlator_t *this,          options = data; -        ret = dict_allocate_and_serialize (options, -                                           &req.dict.dict_val, -                                           (size_t *)&req.dict.dict_len); +        ret = dict_allocate_and_serialize (options, &req.dict.dict_val, +                                           &req.dict.dict_len);          if (ret < 0) {                  gf_log ("cli", GF_LOG_ERROR,                          "failed to serialize the data"); diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index a98492fac7b..9262451c686 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -187,7 +187,7 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret)          if (dict)                  ret = dict_allocate_and_serialize (dict, &rsp.output.output_val, -                                                (size_t *)&rsp.output.output_len); +                                                   &rsp.output.output_len);          if (ret == 0) @@ -229,7 +229,7 @@ glusterfs_translator_info_response_send (rpcsvc_request_t *req, int ret,          if (output) {                  ret = dict_allocate_and_serialize (output,                                                     &rsp.output.output_val, -                                              (size_t *)&rsp.output.output_len); +                                                   &rsp.output.output_len);          }          if (!ret)                  free_ptr = _gf_true; @@ -321,7 +321,7 @@ glusterfs_xlator_op_response_send (rpcsvc_request_t *req, int op_ret,          if (output) {                  ret = dict_allocate_and_serialize (output,                                                     &rsp.output.output_val, -                                              (size_t *)&rsp.output.output_len); +                                                   &rsp.output.output_len);          }          if (!ret)                  free_ptr = _gf_true; @@ -907,7 +907,7 @@ glusterfs_handle_brick_status (rpcsvc_request_t *req)                  rsp.op_errstr = "";          ret = dict_allocate_and_serialize (output, &rsp.output.output_val, -                                           (size_t *)&rsp.output.output_len); +                                           &rsp.output.output_len);          if (ret) {                  gf_log (this->name, GF_LOG_ERROR,                          "Failed to serialize output dict to rsp"); @@ -1091,7 +1091,7 @@ glusterfs_handle_node_status (rpcsvc_request_t *req)                  rsp.op_errstr = "";          ret = dict_allocate_and_serialize (output, &rsp.output.output_val, -                                           (size_t *)&rsp.output.output_len); +                                           &rsp.output.output_len);          if (ret) {                  gf_log (THIS->name, GF_LOG_ERROR,                          "Failed to serialize output dict to rsp"); @@ -1189,7 +1189,7 @@ glusterfs_handle_nfs_profile (rpcsvc_request_t *req)          rsp.op_errstr = "";          ret = dict_allocate_and_serialize (output, &rsp.output.output_val, -                                           (size_t *)&rsp.output.output_len); +                                           &rsp.output.output_len);          if (ret) {                  gf_log (THIS->name, GF_LOG_ERROR,                          "Failed to serialize output dict to rsp"); @@ -1767,7 +1767,7 @@ glusterfs_rebalance_event_notify (dict_t *dict)                          gf_log ("", GF_LOG_ERROR, "failed to set volname");                  ret = dict_allocate_and_serialize (dict, &req.dict.dict_val, -                                                (size_t *)&req.dict.dict_len); +                                                   &req.dict.dict_len);          }          ret = mgmt_submit_request (&req, frame, ctx, &clnt_handshake_prog, diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index 5ae61fd3d3b..2e61a3f4e33 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -2486,7 +2486,7 @@ out:   */  int32_t -dict_allocate_and_serialize (dict_t *this, char **buf, size_t *length) +dict_allocate_and_serialize (dict_t *this, char **buf, u_int *length)  {          int           ret    = -EINVAL;          ssize_t       len = 0; diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h index 2a875039661..17e9bcb451e 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -29,13 +29,11 @@ typedef struct _data_pair data_pair_t;  #define GF_PROTOCOL_DICT_SERIALIZE(this,from_dict,to,len,ope,labl) do { \                  int    ret     = 0;                                     \ -                size_t dictlen = 0;                                     \                                                                          \                  if (!from_dict)                                         \                          break;                                          \                                                                          \ -                ret = dict_allocate_and_serialize (from_dict, to,       \ -                                                   &dictlen);           \ +                ret = dict_allocate_and_serialize (from_dict, to, &len);\                  if (ret < 0) {                                          \                          gf_log (this->name, GF_LOG_WARNING,             \                                  "failed to get serialized dict (%s)",   \ @@ -43,7 +41,6 @@ typedef struct _data_pair data_pair_t;                          ope = EINVAL;                                   \                          goto labl;                                      \                  }                                                       \ -                len = dictlen;                                          \          } while (0) @@ -117,7 +114,7 @@ int32_t dict_serialized_length (dict_t *dict);  int32_t dict_serialize (dict_t *dict, char *buf);  int32_t dict_unserialize (char *buf, int32_t size, dict_t **fill); -int32_t dict_allocate_and_serialize (dict_t *this, char **buf, size_t *length); +int32_t dict_allocate_and_serialize (dict_t *this, char **buf, u_int *length);  void dict_destroy (dict_t *dict);  void dict_unref (dict_t *dict); 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; diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index d0e8882fb7a..afe1efd479a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -233,7 +233,7 @@ glusterd_brick_op_build_payload (glusterd_op_t op, glusterd_brickinfo_t *brickin          }          ret = dict_allocate_and_serialize (dict, &brick_req->input.input_val, -                                           (size_t*)&brick_req->input.input_len); +                                           &brick_req->input.input_len);          if (ret)                  goto out;          *req = brick_req; @@ -285,7 +285,7 @@ glusterd_node_op_build_payload (glusterd_op_t op, gd1_mgmt_brick_op_req **req,          }          ret = dict_allocate_and_serialize (dict, &brick_req->input.input_val, -                                           (size_t*)&brick_req->input.input_len); +                                           &brick_req->input.input_len);          if (ret)                  goto out; 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; diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 7cdc1c3c28b..2b2e9d2e69d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -295,8 +295,8 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid,          args.op_ret = -1;          args.op_errno = ENOTCONN; -        ret = dict_allocate_and_serialize (dict_out, &req.buf.buf_val, -                                           (size_t *)&req.buf.buf_len); +        ret = dict_allocate_and_serialize (dict_out, +                                           &req.buf.buf_val, &req.buf.buf_len);          if (ret)                  goto out; @@ -395,8 +395,8 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid          args.op_ret = -1;          args.op_errno = ENOTCONN; -        ret = dict_allocate_and_serialize (dict_out, &req.buf.buf_val, -                                           (size_t *)&req.buf.buf_len); +        ret = dict_allocate_and_serialize (dict_out, +                                           &req.buf.buf_val, &req.buf.buf_len);          if (ret)                  goto out;  | 
