From 2ef2b600b98d029983bc2eb3b173d0bd201916b4 Mon Sep 17 00:00:00 2001 From: Sanju Rakonde Date: Wed, 1 Nov 2017 12:14:36 +0530 Subject: glusterd/mgmt: coverity fixes This patch fixes coverity issues 179, 59. Problem: control flow won't enter into if block as volname is always NULL and return value of function synctask_barrier_init is unchecked. Fix: remove condition checking which is always resulting in false, and removing if block which is always unreachable. As a result of removal of condition checking volname became a unused variable, so remove declaration of volname. assign return valur of synctask_barrier_init to ret, if it nonzero value goto out. Change-Id: I870aeb020034e97a761e9314f7ace7573f7c520c BUG: 789278 Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-mgmt.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 13a4526ebe0..3fb90766082 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -687,7 +687,6 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_op_t op, dict_t *dict, gf_boolean_t *is_acquired, uint32_t txn_generation) { - char *volname = NULL; glusterd_peerinfo_t *peerinfo = NULL; int32_t ret = -1; int32_t peer_cnt = 0; @@ -763,15 +762,9 @@ out: GD_MSG_MGMTV3_LOCK_GET_FAIL, "%s", *op_errstr); - if (volname) - ret = gf_asprintf (op_errstr, - "Another transaction is in progress " - "for %s. Please try again after " - "sometime.", volname); - else - ret = gf_asprintf (op_errstr, - "Another transaction is in progress " - "Please try again after sometime."); + ret = gf_asprintf (op_errstr, + "Another transaction is in progress. " + "Please try again after sometime."); if (ret == -1) *op_errstr = NULL; @@ -2051,9 +2044,10 @@ glusterd_mgmt_v3_release_peer_locks (glusterd_op_t op, dict_t *dict, /* Sending mgmt_v3 unlock req to other nodes in the cluster */ gd_syncargs_init (&args, NULL); - synctask_barrier_init((&args)); + ret = synctask_barrier_init((&args)); + if (ret) + goto out; peer_cnt = 0; - rcu_read_lock (); cds_list_for_each_entry_rcu (peerinfo, &conf->peers, uuid_list) { /* Only send requests to peers who were available before the -- cgit