summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-08-28 11:03:47 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-08-29 12:34:18 +0000
commit789a5a3d3cbad9c594fd2a94924ec0a2040c27ad (patch)
treed8d832c2c28930725303dd9a8196d79e4d93f2b5
parent2a7ce9ecc919e390208bc3449f6c5fa320b7efe4 (diff)
glusterd: Fix coverity issues
This patch fixes CID's 1395250, 1395252 1395250 - Unintialized variable 1395252 - Out of bounds access updates: bz#789278 Change-Id: Icf646364b14d48fa2bd82ea78ca5cdb5c684355f Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 991a4d2b59e..5591070f32f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -2954,7 +2954,7 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
}
while ( i <= count) {
- snprintf (key, 256, "brick%d", i);
+ snprintf (key, sizeof(key), "brick%d", i);
ret = dict_get_str (dict, key, &brick);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, errno,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 9a3353a1e50..e6efe11cf5c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13143,7 +13143,7 @@ glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *ctx,
char *allvolopt = NULL;
int32_t i = 0;
gf_boolean_t exists = _gf_false;
- gf_boolean_t need_free;
+ gf_boolean_t need_free = _gf_false;
this = THIS;
GF_VALIDATE_OR_GOTO (THIS->name, this, out);
@@ -13203,7 +13203,6 @@ glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *ctx,
/* If global option isn't set explicitly */
- need_free = _gf_false;
if (!def_val) {
if (!strcmp (allvolopt,
GLUSTERD_GLOBAL_OP_VERSION_KEY)) {