summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorSunny Kumar <sunkumar@redhat.com>2018-08-23 18:22:09 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-24 07:08:21 +0000
commit9c49927e64b238cb077ae26c4e77bfe5bfc6a6bd (patch)
treea67de756495c36ca8b076224001dfa509feba31a /xlators/storage
parent52efadc48684a800ab93eac6d2d92f8f34495e53 (diff)
block : fix few coverity issue
Fixes 1128923, 1134020 and 1370936. updates: bz#789278 Change-Id: I2cadc09ffd0814a9390ba068006fa56704d3820d Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/bd/src/bd-aio.c6
-rw-r--r--xlators/storage/bd/src/bd-helper.c6
-rw-r--r--xlators/storage/bd/src/bd.c3
3 files changed, 9 insertions, 6 deletions
diff --git a/xlators/storage/bd/src/bd-aio.c b/xlators/storage/bd/src/bd-aio.c
index c22b905bce5..6f5c90f457e 100644
--- a/xlators/storage/bd/src/bd-aio.c
+++ b/xlators/storage/bd/src/bd-aio.c
@@ -269,11 +269,9 @@ out:
STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, &prebuf, &postbuf,
NULL);
- if (paiocb) {
- if (paiocb->iobref)
+ if (paiocb->iobref)
iobref_unref (paiocb->iobref);
- GF_FREE (paiocb);
- }
+ GF_FREE (paiocb);
return 0;
}
diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c
index ee108b8eda6..ca5a3b741ba 100644
--- a/xlators/storage/bd/src/bd-helper.c
+++ b/xlators/storage/bd/src/bd-helper.c
@@ -897,6 +897,7 @@ bd_do_ioctl_zerofill (bd_priv_t *priv, bd_attr_t *bdatt, int fd, char *vg,
char *p = NULL;
off_t max_bytes = 0;
int sysfd = -1;
+ int ret = 0;
uint64_t param[2] = {0, 0};
off_t nr_loop = 0;
char buff[16] = {0, };
@@ -904,13 +905,16 @@ bd_do_ioctl_zerofill (bd_priv_t *priv, bd_attr_t *bdatt, int fd, char *vg,
uuid_utoa_r (bdatt->iatt.ia_gfid, uuid);
sprintf (lvname, "/dev/%s/%s", vg, uuid);
- if (sys_readlink(lvname, dmname, sizeof(dmname)-1) < 0) {
+ ret = sys_readlink(lvname, dmname, 4096);
+ if (ret < 0) {
gf_log("bd", GF_LOG_DEBUG,
"Failed to read symbolic link '%s': %s",
lvname, strerror(errno));
goto skip;
}
+ dmname[ret] = '\0';
+
p = strrchr (dmname, '/');
if (p)
dm = p + 1;
diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c
index ade12d9092f..08dc35034f8 100644
--- a/xlators/storage/bd/src/bd.c
+++ b/xlators/storage/bd/src/bd.c
@@ -2230,7 +2230,8 @@ bd_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
return 0;
err:
- STACK_UNWIND_STRICT(zerofill, frame, -1, ret, NULL, NULL, NULL);
+ STACK_UNWIND_STRICT(zerofill, frame, -1, (ret == -1 ? 0 : ret),
+ NULL, NULL, NULL);
return 0;
}