summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2018-10-03 20:40:12 +0530
committerN Balachandran <nbalacha@redhat.com>2018-10-05 03:24:47 +0000
commit07cb6a486502fa0f7ea141e7600ec67015383546 (patch)
treeaba6f3d00a9251bb4cb2a61fff896e8d3a3bad7d /xlators/cluster/dht/src/dht-common.c
parentf87d1a1e3374596bc5ee9dad2aee8d12db657da5 (diff)
dht: coverity fixes
CID: 1356541 Issue: Dereference null return value CID: 1382411 Issue: Dereference after null check CID: 1391409 Issue: Unchecked return value Change-Id: Id3d4feb4e88df424003cc8e8a1540e77bbe030e3 Updates: bz#789278 Signed-off-by: Susant Palai <spalai@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index c5d75d4153c..0f668e67793 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1530,12 +1530,11 @@ dht_revalidate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
GF_VALIDATE_OR_GOTO("dht", this, err);
GF_VALIDATE_OR_GOTO("dht", frame->local, err);
GF_VALIDATE_OR_GOTO("dht", cookie, err);
+ GF_VALIDATE_OR_GOTO("dht", this->private, err);
local = frame->local;
prev = cookie;
conf = this->private;
- if (!conf)
- goto out;
if (!conf->vch_forced) {
ret = dict_get_uint32(xattr, conf->commithash_xattr_name,
@@ -1728,7 +1727,6 @@ unlock:
}
}
-out:
this_call_cnt = dht_frame_return(frame);
if (is_last_call(this_call_cnt)) {
@@ -7560,7 +7558,18 @@ dht_handle_parent_layout_change(xlator_t *this, call_stub_t *stub)
local = frame->local;
refresh_frame = copy_frame(frame);
+ if (!refresh_frame) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, DHT_MSG_NO_MEMORY,
+ "mem allocation failed for refresh_frame");
+ return -1;
+ }
+
refresh_local = dht_local_init(refresh_frame, NULL, NULL, stub->fop);
+ if (!refresh_local) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, DHT_MSG_NO_MEMORY,
+ "mem allocation failed for refresh_local");
+ return -1;
+ }
refresh_local->loc.inode = inode_ref(local->loc.parent);
gf_uuid_copy(refresh_local->loc.gfid, local->loc.parent->gfid);
@@ -9027,7 +9036,11 @@ dht_mkdir_hashed_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
goto err;
}
- dht_handle_parent_layout_change(this, stub);
+ ret = dht_handle_parent_layout_change(this, stub);
+ if (ret) {
+ goto err;
+ }
+
stub = NULL;
return 0;