From fb976636d9ffa3be4d2a47c604a7746be06e2247 Mon Sep 17 00:00:00 2001 From: Barak Sason Date: Thu, 15 Aug 2019 17:23:17 +0300 Subject: 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 --- xlators/features/cloudsync/src/cloudsync.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'xlators/features') 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; } } -- cgit