9ae3f9
From aa215163cb7d806dc98bef2386a4e282a5e54a31 Mon Sep 17 00:00:00 2001
9ae3f9
From: Atin Mukherjee <amukherj@redhat.com>
9ae3f9
Date: Thu, 25 Apr 2019 12:00:52 +0530
9ae3f9
Subject: [PATCH 432/449] glusterd: Fix coverity defects & put coverity
9ae3f9
 annotations
9ae3f9
9ae3f9
Along with fixing few defect, put the required annotations for the defects which
9ae3f9
are marked ignore/false positive/intentional as per the coverity defect sheet.
9ae3f9
This should avoid the per component graph showing many defects as open in the
9ae3f9
coverity glusterfs web page.
9ae3f9
9ae3f9
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22619/
9ae3f9
> Updates: bz#789278
9ae3f9
> Change-Id: I19461dc3603a3bd8f88866a1ab3db43d783af8e4
9ae3f9
> Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
9ae3f9
9ae3f9
BUG: 1787310
9ae3f9
Change-Id: I19461dc3603a3bd8f88866a1ab3db43d783af8e4
9ae3f9
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/202631
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-brick-ops.c     |  7 +++--
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-geo-rep.c       |  3 +-
9ae3f9
 .../glusterd/src/glusterd-gfproxyd-svc-helper.c    |  2 +-
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-handler.c       |  8 ++++-
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-mountbroker.c   |  5 ++-
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-op-sm.c         |  8 +++++
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-peer-utils.c    |  2 ++
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-server-quorum.c |  1 +
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-store.c         |  4 ---
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-svc-helper.c    |  4 +--
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-syncop.c        |  1 +
9ae3f9
 .../mgmt/glusterd/src/glusterd-tierd-svc-helper.c  |  4 +--
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-utils.c         |  9 ++++--
9ae3f9
 xlators/mgmt/glusterd/src/glusterd-volgen.c        | 36 +++++++++++++---------
9ae3f9
 14 files changed, 63 insertions(+), 31 deletions(-)
9ae3f9
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9ae3f9
index d424f31..121346c 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
9ae3f9
@@ -2032,7 +2032,6 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
9ae3f9
         case GF_OP_CMD_STATUS:
9ae3f9
             ret = 0;
9ae3f9
             goto out;
9ae3f9
-
9ae3f9
         case GF_OP_CMD_DETACH_START:
9ae3f9
             if (volinfo->type != GF_CLUSTER_TYPE_TIER) {
9ae3f9
                 snprintf(msg, sizeof(msg),
9ae3f9
@@ -2044,7 +2043,7 @@ glusterd_op_stage_remove_brick(dict_t *dict, char **op_errstr)
9ae3f9
                        errstr);
9ae3f9
                 goto out;
9ae3f9
             }
9ae3f9
-
9ae3f9
+        /* Fall through */
9ae3f9
         case GF_OP_CMD_START: {
9ae3f9
             if ((volinfo->type == GF_CLUSTER_TYPE_REPLICATE) &&
9ae3f9
                 dict_getn(dict, "replica-count", SLEN("replica-count"))) {
9ae3f9
@@ -2259,7 +2258,8 @@ out:
9ae3f9
         if (op_errstr)
9ae3f9
             *op_errstr = errstr;
9ae3f9
     }
9ae3f9
-
9ae3f9
+    if (!op_errstr && errstr)
9ae3f9
+        GF_FREE(errstr);
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
@@ -2687,6 +2687,7 @@ glusterd_op_remove_brick(dict_t *dict, char **op_errstr)
9ae3f9
              * Update defrag_cmd as well or it will only be done
9ae3f9
              * for nodes on which the brick to be removed exists.
9ae3f9
              */
9ae3f9
+            /* coverity[MIXED_ENUMS] */
9ae3f9
             volinfo->rebal.defrag_cmd = cmd;
9ae3f9
             volinfo->rebal.defrag_status = GF_DEFRAG_STATUS_NOT_STARTED;
9ae3f9
             ret = dict_get_strn(dict, GF_REMOVE_BRICK_TID_KEY,
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
9ae3f9
index 85c06c1..5a91df4 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
9ae3f9
@@ -4107,6 +4107,7 @@ gd_pause_or_resume_gsync(dict_t *dict, char *master, char *slave,
9ae3f9
 
9ae3f9
 out:
9ae3f9
     sys_close(pfd);
9ae3f9
+    /* coverity[INTEGER_OVERFLOW] */
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
@@ -4183,7 +4184,7 @@ stop_gsync(char *master, char *slave, char **msg, char *conf_path,
9ae3f9
 
9ae3f9
 out:
9ae3f9
     sys_close(pfd);
9ae3f9
-
9ae3f9
+    /* coverity[INTEGER_OVERFLOW] */
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
9ae3f9
index 67e3f41..e338bf4 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc-helper.c
9ae3f9
@@ -111,7 +111,7 @@ glusterd_svc_get_gfproxyd_volfile(glusterd_volinfo_t *volinfo, char *svc_name,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
9ae3f9
+    /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
9ae3f9
     tmp_fd = mkstemp(*tmpvol);
9ae3f9
     if (tmp_fd < 0) {
9ae3f9
         gf_msg("glusterd", GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
9ae3f9
index 2e73c98..1f31e72 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
9ae3f9
@@ -930,6 +930,7 @@ __glusterd_handle_cluster_lock(rpcsvc_request_t *req)
9ae3f9
 
9ae3f9
     op_ctx = dict_new();
9ae3f9
     if (!op_ctx) {
9ae3f9
+        ret = -1;
9ae3f9
         gf_msg(this->name, GF_LOG_ERROR, ENOMEM, GD_MSG_DICT_CREATE_FAIL,
9ae3f9
                "Unable to set new dict");
9ae3f9
         goto out;
9ae3f9
@@ -956,6 +957,9 @@ out:
9ae3f9
     glusterd_friend_sm();
9ae3f9
     glusterd_op_sm();
9ae3f9
 
9ae3f9
+    if (ret)
9ae3f9
+        GF_FREE(ctx);
9ae3f9
+
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
@@ -3470,6 +3474,7 @@ glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options,
9ae3f9
     GF_ASSERT(this);
9ae3f9
 
9ae3f9
     GF_ASSERT(options);
9ae3f9
+    GF_VALIDATE_OR_GOTO(this->name, rpc, out);
9ae3f9
 
9ae3f9
     if (force && rpc && *rpc) {
9ae3f9
         (void)rpc_clnt_unref(*rpc);
9ae3f9
@@ -3482,7 +3487,6 @@ glusterd_rpc_create(struct rpc_clnt **rpc, dict_t *options,
9ae3f9
         goto out;
9ae3f9
 
9ae3f9
     ret = rpc_clnt_register_notify(new_rpc, notify_fn, notify_data);
9ae3f9
-    *rpc = new_rpc;
9ae3f9
     if (ret)
9ae3f9
         goto out;
9ae3f9
     ret = rpc_clnt_start(new_rpc);
9ae3f9
@@ -3491,6 +3495,8 @@ out:
9ae3f9
         if (new_rpc) {
9ae3f9
             (void)rpc_clnt_unref(new_rpc);
9ae3f9
         }
9ae3f9
+    } else {
9ae3f9
+        *rpc = new_rpc;
9ae3f9
     }
9ae3f9
 
9ae3f9
     gf_msg_debug(this->name, 0, "returning %d", ret);
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
9ae3f9
index 332ddef..c017ccb 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
9ae3f9
@@ -334,7 +334,10 @@ make_ghadoop_mountspec(gf_mount_spec_t *mspec, const char *volname, char *user,
9ae3f9
     if (ret == -1)
9ae3f9
         return ret;
9ae3f9
 
9ae3f9
-    return parse_mount_pattern_desc(mspec, hadoop_mnt_desc);
9ae3f9
+    ret = parse_mount_pattern_desc(mspec, hadoop_mnt_desc);
9ae3f9
+    GF_FREE(hadoop_mnt_desc);
9ae3f9
+
9ae3f9
+    return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
 static gf_boolean_t
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
9ae3f9
index 6475611..46fc607 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
9ae3f9
@@ -2467,6 +2467,7 @@ glusterd_start_bricks(glusterd_volinfo_t *volinfo)
9ae3f9
         if (!brickinfo->start_triggered) {
9ae3f9
             pthread_mutex_lock(&brickinfo->restart_mutex);
9ae3f9
             {
9ae3f9
+                /* coverity[SLEEP] */
9ae3f9
                 ret = glusterd_brick_start(volinfo, brickinfo, _gf_false,
9ae3f9
                                            _gf_false);
9ae3f9
             }
9ae3f9
@@ -3466,6 +3467,7 @@ _add_task_to_dict(dict_t *dict, glusterd_volinfo_t *volinfo, int op, int index)
9ae3f9
 
9ae3f9
     switch (op) {
9ae3f9
         case GD_OP_REMOVE_TIER_BRICK:
9ae3f9
+        /* Fall through */
9ae3f9
         case GD_OP_REMOVE_BRICK:
9ae3f9
             snprintf(key, sizeof(key), "task%d", index);
9ae3f9
             ret = _add_remove_bricks_to_dict(dict, volinfo, key);
9ae3f9
@@ -7550,6 +7552,7 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
9ae3f9
     glusterd_op_t op = GD_OP_NONE;
9ae3f9
     glusterd_req_ctx_t *req_ctx = NULL;
9ae3f9
     char *op_errstr = NULL;
9ae3f9
+    gf_boolean_t free_req_ctx = _gf_false;
9ae3f9
 
9ae3f9
     this = THIS;
9ae3f9
     priv = this->private;
9ae3f9
@@ -7558,6 +7561,9 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
9ae3f9
         req_ctx = ctx;
9ae3f9
     } else {
9ae3f9
         req_ctx = GF_CALLOC(1, sizeof(*req_ctx), gf_gld_mt_op_allack_ctx_t);
9ae3f9
+        if (!req_ctx)
9ae3f9
+            goto out;
9ae3f9
+        free_req_ctx = _gf_true;
9ae3f9
         op = glusterd_op_get_op();
9ae3f9
         req_ctx->op = op;
9ae3f9
         gf_uuid_copy(req_ctx->uuid, MY_UUID);
9ae3f9
@@ -7588,6 +7594,8 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
9ae3f9
     }
9ae3f9
 
9ae3f9
 out:
9ae3f9
+    if (ret && req_ctx && free_req_ctx)
9ae3f9
+        GF_FREE(req_ctx);
9ae3f9
     gf_msg_debug(this->name, 0, "Returning with %d", ret);
9ae3f9
 
9ae3f9
     return ret;
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
9ae3f9
index 8c1feeb..1a65359 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
9ae3f9
@@ -82,6 +82,7 @@ glusterd_peerinfo_cleanup(glusterd_peerinfo_t *peerinfo)
9ae3f9
     call_rcu(&peerinfo->rcu_head.head, glusterd_peerinfo_destroy);
9ae3f9
 
9ae3f9
     if (quorum_action)
9ae3f9
+        /* coverity[SLEEP] */
9ae3f9
         glusterd_do_quorum_action();
9ae3f9
     return 0;
9ae3f9
 }
9ae3f9
@@ -358,6 +359,7 @@ glusterd_uuid_to_hostname(uuid_t uuid)
9ae3f9
 
9ae3f9
     if (!gf_uuid_compare(MY_UUID, uuid)) {
9ae3f9
         hostname = gf_strdup("localhost");
9ae3f9
+        return hostname;
9ae3f9
     }
9ae3f9
     RCU_READ_LOCK;
9ae3f9
     if (!cds_list_empty(&priv->peers)) {
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
9ae3f9
index fd334e6..f378187 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
9ae3f9
@@ -372,6 +372,7 @@ glusterd_do_volume_quorum_action(xlator_t *this, glusterd_volinfo_t *volinfo,
9ae3f9
             if (!brickinfo->start_triggered) {
9ae3f9
                 pthread_mutex_lock(&brickinfo->restart_mutex);
9ae3f9
                 {
9ae3f9
+                    /* coverity[SLEEP] */
9ae3f9
                     ret = glusterd_brick_start(volinfo, brickinfo, _gf_false,
9ae3f9
                                                _gf_false);
9ae3f9
                 }
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
9ae3f9
index b3b5ee9..4fa8116 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
9ae3f9
@@ -4764,10 +4764,6 @@ glusterd_store_retrieve_peers(xlator_t *this)
9ae3f9
          */
9ae3f9
         address = cds_list_entry(peerinfo->hostnames.next,
9ae3f9
                                  glusterd_peer_hostname_t, hostname_list);
9ae3f9
-        if (!address) {
9ae3f9
-            ret = -1;
9ae3f9
-            goto next;
9ae3f9
-        }
9ae3f9
         peerinfo->hostname = gf_strdup(address->hostname);
9ae3f9
 
9ae3f9
         ret = glusterd_friend_add_from_peerinfo(peerinfo, 1, NULL);
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
9ae3f9
index ca19a75..1d1f42d 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
9ae3f9
@@ -179,7 +179,7 @@ glusterd_svc_check_volfile_identical(char *svc_name,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
9ae3f9
+    /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
9ae3f9
     tmp_fd = mkstemp(tmpvol);
9ae3f9
     if (tmp_fd < 0) {
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
9ae3f9
@@ -241,7 +241,7 @@ glusterd_svc_check_topology_identical(char *svc_name,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
9ae3f9
+    /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
9ae3f9
     tmpfd = mkstemp(tmpvol);
9ae3f9
     if (tmpfd < 0) {
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
9ae3f9
index 618d8bc..9e47d14 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
9ae3f9
@@ -1752,6 +1752,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
9ae3f9
                 if (dict_get(op_ctx, "client-count"))
9ae3f9
                     break;
9ae3f9
             }
9ae3f9
+            /* coverity[MIXED_ENUMS] */
9ae3f9
         } else if (cmd == GF_OP_CMD_DETACH_START) {
9ae3f9
             op = GD_OP_REMOVE_BRICK;
9ae3f9
             dict_del(req_dict, "rebalance-command");
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
9ae3f9
index 922eae7..59843a0 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc-helper.c
9ae3f9
@@ -116,7 +116,7 @@ glusterd_svc_check_tier_volfile_identical(char *svc_name,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
9ae3f9
+    /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
9ae3f9
     tmp_fd = mkstemp(tmpvol);
9ae3f9
     if (tmp_fd < 0) {
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
9ae3f9
@@ -177,7 +177,7 @@ glusterd_svc_check_tier_topology_identical(char *svc_name,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    /* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
9ae3f9
+    /* coverity[SECURE_TEMP] mkstemp uses 0600 as the mode and is safe */
9ae3f9
     tmpfd = mkstemp(tmpvol);
9ae3f9
     if (tmpfd < 0) {
9ae3f9
         gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
9ae3f9
index 14e23d1..8b0fc9a 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
9ae3f9
@@ -908,6 +908,7 @@ glusterd_create_sub_tier_volinfo(glusterd_volinfo_t *volinfo,
9ae3f9
         (*dup_volinfo)->brick_count = tier_info->cold_brick_count;
9ae3f9
     }
9ae3f9
 out:
9ae3f9
+    /* coverity[REVERSE_NULL] */
9ae3f9
     if (ret && *dup_volinfo) {
9ae3f9
         glusterd_volinfo_delete(*dup_volinfo);
9ae3f9
         *dup_volinfo = NULL;
9ae3f9
@@ -2738,6 +2739,7 @@ glusterd_readin_file(const char *filepath, int *line_count)
9ae3f9
     /* Reduce allocation to minimal size.  */
9ae3f9
     p = GF_REALLOC(lines, (counter + 1) * sizeof(char *));
9ae3f9
     if (!p) {
9ae3f9
+        /* coverity[TAINTED_SCALAR] */
9ae3f9
         free_lines(lines, counter);
9ae3f9
         lines = NULL;
9ae3f9
         goto out;
9ae3f9
@@ -6782,6 +6784,7 @@ glusterd_restart_bricks(void *opaque)
9ae3f9
                 if (!brickinfo->start_triggered) {
9ae3f9
                     pthread_mutex_lock(&brickinfo->restart_mutex);
9ae3f9
                     {
9ae3f9
+                        /* coverity[SLEEP] */
9ae3f9
                         glusterd_brick_start(volinfo, brickinfo, _gf_false,
9ae3f9
                                              _gf_false);
9ae3f9
                     }
9ae3f9
@@ -8886,7 +8889,7 @@ glusterd_nfs_statedump(char *options, int option_cnt, char **op_errstr)
9ae3f9
     kill(pid, SIGUSR1);
9ae3f9
 
9ae3f9
     sleep(1);
9ae3f9
-
9ae3f9
+    /* coverity[TAINTED_STRING] */
9ae3f9
     sys_unlink(dumpoptions_path);
9ae3f9
     ret = 0;
9ae3f9
 out:
9ae3f9
@@ -9012,6 +9015,7 @@ glusterd_quotad_statedump(char *options, int option_cnt, char **op_errstr)
9ae3f9
 
9ae3f9
     sleep(1);
9ae3f9
 
9ae3f9
+    /* coverity[TAINTED_STRING] */
9ae3f9
     sys_unlink(dumpoptions_path);
9ae3f9
     ret = 0;
9ae3f9
 out:
9ae3f9
@@ -13423,7 +13427,7 @@ glusterd_get_global_options_for_all_vols(rpcsvc_request_t *req, dict_t *ctx,
9ae3f9
         if (key_fixed)
9ae3f9
             key = key_fixed;
9ae3f9
     }
9ae3f9
-
9ae3f9
+    /* coverity[CONSTANT_EXPRESSION_RESULT] */
9ae3f9
     ALL_VOLUME_OPTION_CHECK("all", _gf_true, key, ret, op_errstr, out);
9ae3f9
 
9ae3f9
     for (i = 0; valid_all_vol_opts[i].option; i++) {
9ae3f9
@@ -14153,6 +14157,7 @@ glusterd_disallow_op_for_tier(glusterd_volinfo_t *volinfo, glusterd_op_t op,
9ae3f9
             break;
9ae3f9
         case GD_OP_REMOVE_BRICK:
9ae3f9
             switch (cmd) {
9ae3f9
+                /* coverity[MIXED_ENUMS] */
9ae3f9
                 case GF_DEFRAG_CMD_DETACH_START:
9ae3f9
                 case GF_OP_CMD_DETACH_COMMIT_FORCE:
9ae3f9
                 case GF_OP_CMD_DETACH_COMMIT:
9ae3f9
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
9ae3f9
index 539e8a5..6852f8e 100644
9ae3f9
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
9ae3f9
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
9ae3f9
@@ -322,7 +322,7 @@ volopt_trie_cbk(char *word, void *param)
9ae3f9
 }
9ae3f9
 
9ae3f9
 static int
9ae3f9
-process_nodevec(struct trienodevec *nodevec, char **hint)
9ae3f9
+process_nodevec(struct trienodevec *nodevec, char **outputhint, char *inputhint)
9ae3f9
 {
9ae3f9
     int ret = 0;
9ae3f9
     char *hint1 = NULL;
9ae3f9
@@ -331,14 +331,14 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
9ae3f9
     trienode_t **nodes = nodevec->nodes;
9ae3f9
 
9ae3f9
     if (!nodes[0]) {
9ae3f9
-        *hint = NULL;
9ae3f9
+        *outputhint = NULL;
9ae3f9
         return 0;
9ae3f9
     }
9ae3f9
 
9ae3f9
 #if 0
9ae3f9
         /* Limit as in git */
9ae3f9
         if (trienode_get_dist (nodes[0]) >= 6) {
9ae3f9
-                *hint = NULL;
9ae3f9
+                *outputhint = NULL;
9ae3f9
                 return 0;
9ae3f9
         }
9ae3f9
 #endif
9ae3f9
@@ -347,23 +347,30 @@ process_nodevec(struct trienodevec *nodevec, char **hint)
9ae3f9
         return -1;
9ae3f9
 
9ae3f9
     if (nodevec->cnt < 2 || !nodes[1]) {
9ae3f9
-        *hint = hint1;
9ae3f9
+        *outputhint = hint1;
9ae3f9
         return 0;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    if (trienode_get_word(nodes[1], &hint2))
9ae3f9
+    if (trienode_get_word(nodes[1], &hint2)) {
9ae3f9
+        GF_FREE(hint1);
9ae3f9
         return -1;
9ae3f9
+    }
9ae3f9
 
9ae3f9
-    if (*hint)
9ae3f9
-        hintinfx = *hint;
9ae3f9
-    ret = gf_asprintf(hint, "%s or %s%s", hint1, hintinfx, hint2);
9ae3f9
+    if (inputhint)
9ae3f9
+        hintinfx = inputhint;
9ae3f9
+    ret = gf_asprintf(outputhint, "%s or %s%s", hint1, hintinfx, hint2);
9ae3f9
     if (ret > 0)
9ae3f9
         ret = 0;
9ae3f9
+    if (hint1)
9ae3f9
+        GF_FREE(hint1);
9ae3f9
+    if (hint2)
9ae3f9
+        GF_FREE(hint2);
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
 static int
9ae3f9
-volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
9ae3f9
+volopt_trie_section(int lvl, char **patt, char *word, char **outputhint,
9ae3f9
+                    char *inputhint, int hints)
9ae3f9
 {
9ae3f9
     trienode_t *nodes[] = {NULL, NULL};
9ae3f9
     struct trienodevec nodevec = {nodes, 2};
9ae3f9
@@ -384,7 +391,7 @@ volopt_trie_section(int lvl, char **patt, char *word, char **hint, int hints)
9ae3f9
     nodevec.cnt = hints;
9ae3f9
     ret = trie_measure_vec(trie, word, &nodevec);
9ae3f9
     if (!ret && nodevec.nodes[0])
9ae3f9
-        ret = process_nodevec(&nodevec, hint);
9ae3f9
+        ret = process_nodevec(&nodevec, outputhint, inputhint);
9ae3f9
 
9ae3f9
     trie_destroy(trie);
9ae3f9
 
9ae3f9
@@ -396,6 +403,7 @@ volopt_trie(char *key, char **hint)
9ae3f9
 {
9ae3f9
     char *patt[] = {NULL};
9ae3f9
     char *fullhint = NULL;
9ae3f9
+    char *inputhint = NULL;
9ae3f9
     char *dot = NULL;
9ae3f9
     char *dom = NULL;
9ae3f9
     int len = 0;
9ae3f9
@@ -405,7 +413,7 @@ volopt_trie(char *key, char **hint)
9ae3f9
 
9ae3f9
     dot = strchr(key, '.');
9ae3f9
     if (!dot)
9ae3f9
-        return volopt_trie_section(1, patt, key, hint, 2);
9ae3f9
+        return volopt_trie_section(1, patt, key, hint, inputhint, 2);
9ae3f9
 
9ae3f9
     len = dot - key;
9ae3f9
     dom = gf_strdup(key);
9ae3f9
@@ -413,7 +421,7 @@ volopt_trie(char *key, char **hint)
9ae3f9
         return -1;
9ae3f9
     dom[len] = '\0';
9ae3f9
 
9ae3f9
-    ret = volopt_trie_section(0, NULL, dom, patt, 1);
9ae3f9
+    ret = volopt_trie_section(0, NULL, dom, patt, inputhint, 1);
9ae3f9
     GF_FREE(dom);
9ae3f9
     if (ret) {
9ae3f9
         patt[0] = NULL;
9ae3f9
@@ -422,8 +430,8 @@ volopt_trie(char *key, char **hint)
9ae3f9
     if (!patt[0])
9ae3f9
         goto out;
9ae3f9
 
9ae3f9
-    *hint = "...";
9ae3f9
-    ret = volopt_trie_section(1, patt, dot + 1, hint, 2);
9ae3f9
+    inputhint = "...";
9ae3f9
+    ret = volopt_trie_section(1, patt, dot + 1, hint, inputhint, 2);
9ae3f9
     if (ret)
9ae3f9
         goto out;
9ae3f9
     if (*hint) {
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9