diff options
author | Mohammed Azhar Padariyakam <mpadariy@redhat.com> | 2017-11-02 15:23:22 +0530 |
---|---|---|
committer | gluster-ant <bugzilla-bot@gluster.org> | 2017-11-02 15:23:22 +0530 |
commit | 43cf76af8c05d2042a8193dc47ebb75490eb802f (patch) | |
tree | 1934172833ffd26f018089872e60ba5cb1c5bb3e | |
parent | 1c3c2f436b803a43866abd11cda2e91cdb7d441c (diff) | |
download | glusterfs-43cf76af8c05d2042a8193dc47ebb75490eb802f.tar.gz glusterfs-43cf76af8c05d2042a8193dc47ebb75490eb802f.tar.xz glusterfs-43cf76af8c05d2042a8193dc47ebb75490eb802f.zip |
xlators/bd-helper: Coverity Fix CHECKED_RETURN in bd_do_ioctl_zerofill
Problem: bd_do_ioctl_zerofill is called and return value is unchecked
Fix: Check the returned value and goto skip if the returned value < 0
which means its an error.
Coverity Id: 67 from [1]
[1]: https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/
Change-Id: I398873cefaca03f9cd188fa0f4ccba1378a60ed9
BUG: 789278
Signed-off-by: Mohammed Azhar Padariyakam <mpadariy@redhat.com>
-rw-r--r-- | xlators/storage/bd/src/bd-helper.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c index 15f83d3f83..21e7bed915 100644 --- a/xlators/storage/bd/src/bd-helper.c +++ b/xlators/storage/bd/src/bd-helper.c @@ -903,7 +903,12 @@ 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); - sys_readlink (lvname, dmname, sizeof (dmname) - 1); + if (sys_readlink(lvname, dmname, sizeof(dmname)-1) < 0) { + gf_log("bd", GF_LOG_DEBUG, + "Failed to read symbolic link '%s': %s", + lvname, strerror(errno)); + goto skip; + } p = strrchr (dmname, '/'); if (p) |