summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2018-11-23 12:38:44 +0530
committerAmar Tumballi <amarts@redhat.com>2018-11-25 13:15:38 +0000
commit988bbd966d4332f5b1074aea7e5467a6399bac83 (patch)
tree030ac18ae37484168dd1c8f4abece965a37d312d /xlators
parent424978302c7d5d0e03e54a6284c250e951ca694d (diff)
meta/coverity: Fix coverity in meta xlator
CID : 1356536 Macro compares unsigned to 0 https://scan6.coverity.com/reports.htm#v42907/p10714/fileInstanceId=87389645&defectInstanceId=26791929&mergedDefectId=1356536 CID : 1356535 Macro compares unsigned to 0 https://scan6.coverity.com/reports.htm#v42907/p10714/fileInstanceId=87389645&defectInstanceId=26791926&mergedDefectId=1356535 Change-Id: Icb1c9035589fa871c7223f767adbe0dfa672a9b4 updates: bz#789278 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/meta/src/meta-defaults.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/xlators/meta/src/meta-defaults.c b/xlators/meta/src/meta-defaults.c
index 8b0d786483f..b39e9f21ff7 100644
--- a/xlators/meta/src/meta-defaults.c
+++ b/xlators/meta/src/meta-defaults.c
@@ -119,7 +119,7 @@ meta_default_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
struct iobuf *iobuf = NULL;
struct iobref *iobref = NULL;
off_t copy_offset = 0;
- size_t copy_size = 0;
+ int copy_size = 0;
struct iatt iatt = {};
meta_fd = meta_fd_get(fd, this);
@@ -241,6 +241,7 @@ meta_default_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc,
struct meta_ops *ops = NULL;
strfd_t *strfd = NULL;
struct iatt iatt = {};
+ int len = -1;
ops = meta_ops_get(loc->inode, this);
if (!ops->link_fill) {
@@ -258,10 +259,10 @@ meta_default_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc,
meta_iatt_fill(&iatt, loc->inode, IA_IFLNK);
- if (strfd->data)
- META_STACK_UNWIND(readlink, frame, strlen(strfd->data), 0, strfd->data,
- &iatt, xdata);
- else
+ if (strfd->data) {
+ len = strlen(strfd->data);
+ META_STACK_UNWIND(readlink, frame, len, 0, strfd->data, &iatt, xdata);
+ } else
META_STACK_UNWIND(readlink, frame, -1, ENODATA, 0, 0, 0);
strfd_close(strfd);