diff options
author | Manikandan Selvaganesh <mselvaga@redhat.com> | 2015-02-10 14:59:09 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-07 03:52:05 -0700 |
commit | aa0befea352402922839dd846c798c0da2afd271 (patch) | |
tree | 4d813cd07658bafa012f667d02578f329ee93eb5 /xlators/cluster/dht/src/dht-layout.c | |
parent | a0e3634c6f0d349a3433cdbeabd93043f5f43e9d (diff) |
dht : coverity fixes
CID : 1124352,1124365 (unchecked return value),
1124377 ( logically dead code),
1124511 (null dereference)
Change-Id: I61e029a078559cfe15d36bf0aa53418f6214e5cb
BUG: 789278
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/9622
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-layout.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index bbac904743e..2ed15c5e43c 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -69,6 +69,7 @@ dht_layout_get (xlator_t *this, inode_t *inode) { dht_conf_t *conf = NULL; dht_layout_t *layout = NULL; + int ret = 0; conf = this->private; if (!conf) @@ -76,8 +77,8 @@ dht_layout_get (xlator_t *this, inode_t *inode) LOCK (&conf->layout_lock); { - dht_inode_ctx_layout_get (inode, this, &layout); - if (layout) { + ret = dht_inode_ctx_layout_get (inode, this, &layout); + if ((!ret) && layout) { layout->ref++; } } @@ -97,13 +98,14 @@ dht_layout_set (xlator_t *this, inode_t *inode, dht_layout_t *layout) dht_layout_t *old_layout; conf = this->private; - if (!conf) + if (!conf || !layout) goto out; LOCK (&conf->layout_lock); { oldret = dht_inode_ctx_layout_get (inode, this, &old_layout); - layout->ref++; + if (layout) + layout->ref++; dht_inode_ctx_layout_set (inode, this, layout); } UNLOCK (&conf->layout_lock); |