Blame SOURCES/0031-libmultipath-fix-sysfs-dev_loss_tmo-parsing.patch

b7337d
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b7337d
From: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
Date: Thu, 25 Jun 2020 20:46:08 -0500
b7337d
Subject: [PATCH] libmultipath: fix sysfs dev_loss_tmo parsing
b7337d
b7337d
dev_loss_tmo is a u32 value. However the kernel sysfs code prints it as
b7337d
a signed integer. This means that if dev_loss_tmo is above INT_MAX, the
b7337d
sysfs value will be a negative number. Parsing this was causing
b7337d
sysfs_set_rport_tmo() to fail.
b7337d
b7337d
Signed-off-by: Martin Wilck <mwilck@suse.com>
b7337d
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
---
b7337d
 libmultipath/discovery.c | 6 +++---
b7337d
 1 file changed, 3 insertions(+), 3 deletions(-)
b7337d
b7337d
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
b7337d
index ffec5162..83a41a4a 100644
b7337d
--- a/libmultipath/discovery.c
b7337d
+++ b/libmultipath/discovery.c
b7337d
@@ -583,7 +583,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
b7337d
 	struct udev_device *rport_dev = NULL;
b7337d
 	char value[16], *eptr;
b7337d
 	char rport_id[32];
b7337d
-	unsigned long long tmo = 0;
b7337d
+	unsigned int tmo;
b7337d
 	int ret;
b7337d
 
b7337d
 	sprintf(rport_id, "rport-%d:%d-%d",
b7337d
@@ -607,8 +607,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
b7337d
 			"error %d", rport_id, -ret);
b7337d
 		goto out;
b7337d
 	}
b7337d
-	tmo = strtoull(value, &eptr, 0);
b7337d
-	if (value == eptr || tmo == ULLONG_MAX) {
b7337d
+	tmo = strtoul(value, &eptr, 0);
b7337d
+	if (value == eptr) {
b7337d
 		condlog(0, "%s: Cannot parse dev_loss_tmo "
b7337d
 			"attribute '%s'", rport_id, value);
b7337d
 		goto out;
b7337d
-- 
b7337d
2.17.2
b7337d