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>
This commit is contained in:
karthik-us 2018-08-28 12:51:00 +05:30 committed by Ravishankar N
parent 8d171374cb
commit 2a7ce9ecc9
2 changed files with 5 additions and 3 deletions

View File

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

View File

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