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