diff options
author | Sanju Rakonde <srakonde@redhat.com> | 2018-09-21 16:03:22 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-09-25 15:26:19 +0000 |
commit | f1b2455b9d01bae8c4652fc3583a60ff7000410e (patch) | |
tree | 30abf3e835b15f2f315a313a012c5f47008b9a4e /xlators | |
parent | 31dcbb61487ac82b5ae61435add98b0fd1d5e8cc (diff) |
glusterd: fix coverity issues
This patch addreeses CID 1124812, 11248123, 1124833,
and 1351706
1. We have a null check after GF_ASSERT. GF_ASSERT does
a null check and fails if it is null. So removing the
redundant null checks.
2. Added a log message to avoid unused value coverity issue
Change-Id: Ib0d6dad8f40474afc8e5e60a531d37247cc8a081
updates: bz#789278
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 22 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 5 |
3 files changed, 11 insertions, 21 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 1734d5e10e5..d2fefeff9f0 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -1755,6 +1755,11 @@ glusterd_op_quota(dict_t *dict, char **op_errstr, dict_t *rsp_dict) volinfo->quota_xattr_version--; ret = glusterd_store_volinfo(volinfo, GLUSTERD_VOLINFO_VER_AC_INCREMENT); + if (ret) { + gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_SET_FAIL, + "Failed to store volinfo for volume %s", + volinfo->volname); + } } ret = -1; diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 26984b6ffba..2d9987971b8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -723,15 +723,8 @@ _storeslaves(dict_t *this, char *key, data_t *value, void *data) GF_ASSERT(shandle->fd > 0); GF_ASSERT(shandle->path); GF_ASSERT(key); - GF_ASSERT(value && value->data); - - if ((!shandle) || (shandle->fd <= 0) || (!shandle->path)) - return -1; - - if (!key) - return -1; - if (!value || !value->data) - return -1; + GF_ASSERT(value); + GF_ASSERT(value->data); gf_msg_debug(xl->name, 0, "Storing in volinfo:key= %s, val=%s", key, value->data); @@ -764,15 +757,8 @@ _storeopts(dict_t *this, char *key, data_t *value, void *data) GF_ASSERT(shandle->fd > 0); GF_ASSERT(shandle->path); GF_ASSERT(key); - GF_ASSERT(value && value->data); - - if ((!shandle) || (shandle->fd <= 0) || (!shandle->path)) - return -1; - - if (!key) - return -1; - if (!value || !value->data) - return -1; + GF_ASSERT(value); + GF_ASSERT(value->data); if (is_key_glusterd_hooks_friendly(key)) { exists = 1; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 9c00f6b976a..3c32cf90577 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -4725,7 +4725,7 @@ nfs_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme, if (!volinfo || (volinfo->volname[0] == '\0')) return 0; - if (!vme || (vme->option[0] == '\0')) + if (!vme || !(vme->option)) return 0; if (!strcmp(vme->option, "!rpc-auth.addr.*.allow")) { @@ -4851,8 +4851,7 @@ nfs_option_handler(volgen_graph_t *graph, struct volopt_map_entry *vme, return -1; } - if ((strcmp(vme->voltype, "nfs/server") == 0) && - (vme->option && vme->option[0] != '!')) { + if ((strcmp(vme->voltype, "nfs/server") == 0) && (vme->option[0] != '!')) { ret = xlator_set_option(xl, vme->option, vme->value); if (ret) return -1; |