Blame SOURCES/0008-libmultipath-eliminate-more-signed-unsigned-comparis.patch

96a22b
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
96a22b
From: Martin Wilck <mwilck@suse.com>
96a22b
Date: Tue, 12 May 2020 00:39:26 +0200
96a22b
Subject: [PATCH] libmultipath: eliminate more signed/unsigned comparisons
96a22b
96a22b
Fix some more compiler warnings about signed/unsigned comparison.
96a22b
I've observed these only on 32bit builds, therefore they went unnoticed
96a22b
before.
96a22b
96a22b
Signed-off-by: Martin Wilck <mwilck@suse.com>
96a22b
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
96a22b
---
96a22b
 libmultipath/print.c                  | 12 ++++++------
96a22b
 libmultipath/prioritizers/alua_spc3.h |  2 +-
96a22b
 multipathd/cli_handlers.c             | 20 ++++++++++----------
96a22b
 multipathd/main.c                     |  2 +-
96a22b
 4 files changed, 18 insertions(+), 18 deletions(-)
96a22b
96a22b
diff --git a/libmultipath/print.c b/libmultipath/print.c
96a22b
index b944ef32..298b3764 100644
96a22b
--- a/libmultipath/print.c
96a22b
+++ b/libmultipath/print.c
96a22b
@@ -1958,25 +1958,25 @@ char *snprint_config(const struct config *conf, int *len,
96a22b
 		}
96a22b
 
96a22b
 		c = reply + snprint_defaults(conf, reply, maxlen);
96a22b
-		if ((c - reply) == maxlen)
96a22b
+		if (c == reply + maxlen)
96a22b
 			continue;
96a22b
 
96a22b
 		c += snprint_blacklist(conf, c, reply + maxlen - c);
96a22b
-		if ((c - reply) == maxlen)
96a22b
+		if (c == reply + maxlen)
96a22b
 			continue;
96a22b
 
96a22b
 		c += snprint_blacklist_except(conf, c, reply + maxlen - c);
96a22b
-		if ((c - reply) == maxlen)
96a22b
+		if (c == reply + maxlen)
96a22b
 			continue;
96a22b
 
96a22b
 		c += snprint_hwtable(conf, c, reply + maxlen - c,
96a22b
 				     hwtable ? hwtable : conf->hwtable);
96a22b
-		if ((c - reply) == maxlen)
96a22b
+		if (c == reply + maxlen)
96a22b
 			continue;
96a22b
 
96a22b
 		c += snprint_overrides(conf, c, reply + maxlen - c,
96a22b
 				       conf->overrides);
96a22b
-		if ((c - reply) == maxlen)
96a22b
+		if (c == reply + maxlen)
96a22b
 			continue;
96a22b
 
96a22b
 		if (VECTOR_SIZE(conf->mptable) > 0 ||
96a22b
@@ -1984,7 +1984,7 @@ char *snprint_config(const struct config *conf, int *len,
96a22b
 			c += snprint_mptable(conf, c, reply + maxlen - c,
96a22b
 					     mpvec);
96a22b
 
96a22b
-		if ((c - reply) < maxlen) {
96a22b
+		if (c < reply + maxlen) {
96a22b
 			if (len)
96a22b
 				*len = c - reply;
96a22b
 			return reply;
96a22b
diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h
96a22b
index 18b495ef..7ba2cf4c 100644
96a22b
--- a/libmultipath/prioritizers/alua_spc3.h
96a22b
+++ b/libmultipath/prioritizers/alua_spc3.h
96a22b
@@ -284,7 +284,7 @@ struct rtpg_data {
96a22b
 #define RTPG_FOR_EACH_PORT_GROUP(p, g) \
96a22b
 		for( \
96a22b
 			g = &(p->data[0]); \
96a22b
-			(((char *) g) - ((char *) p)) < get_unaligned_be32(p->length); \
96a22b
+			((char *) g) < ((char *) p) + get_unaligned_be32(p->length); \
96a22b
 			g = (struct rtpg_tpg_dscr *) ( \
96a22b
 				((char *) g) + \
96a22b
 				sizeof(struct rtpg_tpg_dscr) + \
96a22b
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
96a22b
index 7d878c88..31c3d9fd 100644
96a22b
--- a/multipathd/cli_handlers.c
96a22b
+++ b/multipathd/cli_handlers.c
96a22b
@@ -66,7 +66,7 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style,
96a22b
 		c += snprint_foreign_paths(c, reply + maxlen - c,
96a22b
 					   style, pretty);
96a22b
 
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -102,7 +102,7 @@ show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
96a22b
 
96a22b
 		c += snprint_path(c, reply + maxlen - c, style, pp, 0);
96a22b
 
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -131,7 +131,7 @@ show_map_topology (char ** r, int * len, struct multipath * mpp,
96a22b
 		c = reply;
96a22b
 
96a22b
 		c += snprint_multipath_topology(c, reply + maxlen - c, mpp, 2);
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -171,7 +171,7 @@ show_maps_topology (char ** r, int * len, struct vectors * vecs)
96a22b
 		}
96a22b
 		c += snprint_foreign_topology(c, reply + maxlen - c, 2);
96a22b
 
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -209,7 +209,7 @@ show_maps_json (char ** r, int * len, struct vectors * vecs)
96a22b
 		c = reply;
96a22b
 
96a22b
 		c += snprint_multipath_topology_json(c, maxlen, vecs);
96a22b
-		again = ((c - reply) == maxlen);
96a22b
+		again = (c == reply + maxlen);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -238,7 +238,7 @@ show_map_json (char ** r, int * len, struct multipath * mpp,
96a22b
 		c = reply;
96a22b
 
96a22b
 		c += snprint_multipath_map_json(c, maxlen, mpp);
96a22b
-		again = ((c - reply) == maxlen);
96a22b
+		again = (c == reply + maxlen);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -487,7 +487,7 @@ show_map (char ** r, int *len, struct multipath * mpp, char * style,
96a22b
 		c += snprint_multipath(c, reply + maxlen - c, style,
96a22b
 				       mpp, pretty);
96a22b
 
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -533,7 +533,7 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style,
96a22b
 		}
96a22b
 		c += snprint_foreign_multipaths(c, reply + maxlen - c,
96a22b
 						style, pretty);
96a22b
-		again = ((c - reply) == (maxlen - 1));
96a22b
+		again = (c == reply + maxlen - 1);
96a22b
 
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
@@ -1297,7 +1297,7 @@ show_blacklist (char ** r, int * len)
96a22b
 
96a22b
 		c = reply;
96a22b
 		c += snprint_blacklist_report(conf, c, maxlen);
96a22b
-		again = ((c - reply) == maxlen);
96a22b
+		again = (c == reply + maxlen);
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
 	pthread_cleanup_pop(1);
96a22b
@@ -1339,7 +1339,7 @@ show_devices (char ** r, int * len, struct vectors *vecs)
96a22b
 
96a22b
 		c = reply;
96a22b
 		c += snprint_devices(conf, c, maxlen, vecs);
96a22b
-		again = ((c - reply) == maxlen);
96a22b
+		again = (c == reply + maxlen);
96a22b
 		REALLOC_REPLY(reply, again, maxlen);
96a22b
 	}
96a22b
 	pthread_cleanup_pop(1);
96a22b
diff --git a/multipathd/main.c b/multipathd/main.c
96a22b
index 8baf9abe..6b7db2c0 100644
96a22b
--- a/multipathd/main.c
96a22b
+++ b/multipathd/main.c
96a22b
@@ -2374,7 +2374,7 @@ checkerloop (void *ap)
96a22b
 				conf = get_multipath_config();
96a22b
 				max_checkint = conf->max_checkint;
96a22b
 				put_multipath_config(conf);
96a22b
-				if (diff_time.tv_sec > max_checkint)
96a22b
+				if (diff_time.tv_sec > (time_t)max_checkint)
96a22b
 					condlog(1, "path checkers took longer "
96a22b
 						"than %lu seconds, consider "
96a22b
 						"increasing max_polling_interval",
96a22b
-- 
96a22b
2.17.2
96a22b