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