From 337b5580aa8872a69631f8af17e1add7bb2a901d Mon Sep 17 00:00:00 2001 From: Mohammed Azhar Padariyakam Date: Thu, 2 Nov 2017 15:23:22 +0530 Subject: 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 --- xlators/storage/bd/src/bd-helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xlators/storage/bd') 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) -- cgit