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