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>
This commit is contained in:
Sanju Rakonde 2018-08-28 11:03:47 +05:30 committed by Atin Mukherjee
parent 2a7ce9ecc9
commit 789a5a3d3c
2 changed files with 2 additions and 3 deletions

View File

@ -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,

View File

@ -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)) {