summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarak Sason <bsasonro@redhat.com>2019-08-15 17:23:17 +0300
committerBarak Sason Rofman <bsasonro@redhat.com>2019-08-21 05:16:30 +0000
commitfb976636d9ffa3be4d2a47c604a7746be06e2247 (patch)
tree940d7222c393b2dba6506a0c625cb09feb66cea3
parent1c3b280602153481fead83622aa885f6735c094c (diff)
features/cloudsync - fix a coverity issue
All assigns to op_errno in this mehod were to the same vlaue - ENOMEM. Removed repeted assignments and assigned as init value. This also prevents the problem of sending a negatve value of op_errno to CS_STACK_UNWIND method CID: 1394645 - https://scan6.coverity.com/reports.htm#v44018/p10714/fileInstanceId=92065749&defectInstanceId=28018364&mergedDefectId=1394645 Updates: bz#789278 Change-Id: If765a9216500a38f9392617aaf06583ce36e3262 Signed-off-by: Barak Sason <bsasonro@redhat.com>
-rw-r--r--xlators/features/cloudsync/src/cloudsync.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/xlators/features/cloudsync/src/cloudsync.c b/xlators/features/cloudsync/src/cloudsync.c
index 0ad987ecf5f..36cf7dbe1b2 100644
--- a/xlators/features/cloudsync/src/cloudsync.c
+++ b/xlators/features/cloudsync/src/cloudsync.c
@@ -1325,7 +1325,7 @@ int32_t
cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, uint32_t flags, dict_t *xdata)
{
- int op_errno = -1;
+ int op_errno = ENOMEM;
cs_local_t *local = NULL;
int ret = 0;
cs_inode_ctx_t *ctx = NULL;
@@ -1341,7 +1341,6 @@ cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
local = cs_local_init(this, frame, NULL, fd, GF_FOP_READ);
if (!local) {
gf_msg(this->name, GF_LOG_ERROR, 0, 0, "local init failed");
- op_errno = ENOMEM;
goto err;
}
@@ -1372,7 +1371,6 @@ cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
}
if (!local->stub) {
gf_msg(this->name, GF_LOG_ERROR, 0, 0, "insufficient memory");
- op_errno = ENOMEM;
goto err;
}
@@ -1384,7 +1382,6 @@ cs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
local->call_cnt++;
ret = locate_and_execute(frame);
if (ret) {
- op_errno = ENOMEM;
goto err;
}
}