[PATCH 11/12] libmultipath/foreign(coverity): retval check in snprint_nvme_path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmultipath/foreign/nvme.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index f0e8293..7e654ec 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -249,8 +249,10 @@ static int snprint_nvme_path(const struct gen_path *gp,
 		devt = udev_device_get_devnum(np->udev);
 		return snprintf(buff, len, "%u:%u", major(devt), minor(devt));
 	case 'o':
-		sysfs_attr_get_value(np->ctl, "state", fld, sizeof(fld));
-		return snprintf(buff, len, "%s", fld);
+		if (sysfs_attr_get_value(np->ctl, "state",
+					 fld, sizeof(fld)) > 0)
+			return snprintf(buff, len, "%s", fld);
+		break;
 	case 'T':
 		if (sysfs_attr_get_value(np->udev, "ana_state", fld,
 					 sizeof(fld)) > 0)
-- 
2.19.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux