summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2018-08-28 12:51:00 +0530
committerRavishankar N <ravishankar@redhat.com>2018-08-29 10:52:07 +0000
commit2a7ce9ecc919e390208bc3449f6c5fa320b7efe4 (patch)
treeab8981c11d51c445140d8811e7e72f21d86a746c /xlators/cluster
parent8d171374cbbbdd88c8714198903b317bd132e1e2 (diff)
cluster/afr: Coverity fixes in afr
Fixes the deadcode issue in "afr-common.c" and null pointer dereference isse in "afr-dir-read.c". CIDs: 1395160, 1389018 Scan details: https://scan6.coverity.com/reports.htm#v42418/p10714/fileInstanceId=85017760&defectInstanceId=25877740&mergedDefectId=1395160 https://scan6.coverity.com/reports.htm#v42418/p10714/fileInstanceId=85017734&defectInstanceId=25877951&mergedDefectId=1389018 Change-Id: I65dff57305aa3ae43544be5353f801d761193e97 updates: bz#789278 Signed-off-by: karthik-us <ksubrahm@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-common.c2
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index cf55ebe1a63..3cc70d205c7 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -6876,8 +6876,6 @@ afr_ta_post_op_lock (xlator_t *this, loc_t *loc)
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, -ret, AFR_MSG_THIN_ARB,
"Failed to get AFR_TA_DOM_MODIFY lock.");
- if (!locked)
- goto out;
flock1.l_type = F_UNLCK;
ret = syncop_inodelk (priv->children[THIN_ARBITER_BRICK_INDEX],
AFR_TA_DOM_NOTIFY, loc, F_SETLK, &flock1,
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index 5218d386c79..76d0cdfa826 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -252,8 +252,12 @@ afr_readdir_wind (call_frame_t *frame, xlator_t *this, int subvol)
priv = this->private;
local = frame->local;
fd_ctx = afr_fd_ctx_get (local->fd, this);
+ if (!fd_ctx) {
+ local->op_errno = EINVAL;
+ local->op_ret = -1;
+ }
- if (subvol == -1) {
+ if (subvol == -1 || !fd_ctx) {
AFR_STACK_UNWIND (readdir, frame, local->op_ret,
local->op_errno, 0, 0);
return 0;