summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorMohammed Azhar Padariyakam <mpadariy@redhat.com>2017-11-02 15:23:22 +0530
committerAmar Tumballi <amarts@redhat.com>2017-11-03 17:24:46 +0000
commit337b5580aa8872a69631f8af17e1add7bb2a901d (patch)
treef3af193f5c41c69149918b06085943746d17e292 /xlators/storage
parent498f8b8c26173a04cf085fbfa56cdb719b46b33c (diff)
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>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/bd/src/bd-helper.c7
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 15f83d3f834..21e7bed9159 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)