All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Minor fixes for multipath-tools
@ 2020-05-11 22:39 mwilck
  2020-05-11 22:39 ` [PATCH 01/11] multipath-tools: Makefile: more dependency fixes for parallel build mwilck
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Hi Christophe, hi Ben,

This series fixes a couple of issues I recently found with the 32bit build
of multipath-tools, and after integrating our CI into the automated builds
on our build server.

Regards
Martin

Martin Wilck (11):
  multipath-tools: Makefile: more dependency fixes for parallel build
  multipath-tools: Makefile.inc: separate out OPTFLAGS
  multipath-tools: Makefile.inc: allow user settings for LDFLAGS
  multipath-tools: Makefile.inc: set -Wno-error=clobbered
  libmultipath: discovery.c: use %z qualifier for size_t
  libmultipath: eliminate more signed/unsigned comparisons
  libmultipath: set_uint: fix parsing for 32bit
  multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS
  multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test
  multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign
  multipath-tools tests/directio: fix -Wmaybe-uninitalized warning

 Makefile                              |  5 +++--
 Makefile.inc                          | 16 ++++++++--------
 libmpathpersist/mpath_pr_ioctl.c      |  2 +-
 libmultipath/dict.c                   | 11 +++++++----
 libmultipath/discovery.c              | 16 ++++++++--------
 libmultipath/print.c                  | 12 ++++++------
 libmultipath/prioritizers/alua_spc3.h |  2 +-
 multipathd/cli_handlers.c             | 20 ++++++++++----------
 multipathd/main.c                     |  2 +-
 tests/Makefile                        |  4 ++--
 tests/directio.c                      |  2 +-
 tests/test-lib.c                      |  6 ------
 12 files changed, 48 insertions(+), 50 deletions(-)

-- 
2.26.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/11] multipath-tools: Makefile: more dependency fixes for parallel build
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 02/11] multipath-tools: Makefile.inc: separate out OPTFLAGS mwilck
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski
  Cc: Christian Hesse, dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Extend the late fixes from Christian.

Cc: Christian Hesse <mail@eworm.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index ba1d73ba..fec3b73b 100644
--- a/Makefile
+++ b/Makefile
@@ -28,8 +28,9 @@ all:	$(BUILDDIRS)
 $(BUILDDIRS):
 	$(MAKE) -C $@
 
-libmpathpersist multipath multipathd mpathpersist: libmultipath
-mpathpersist:  libmpathpersist
+libmultipath libdmmp: libmpathcmd
+libmpathpersist multipath multipathd: libmultipath
+mpathpersist multipathd:  libmpathpersist
 
 $(BUILDDIRS.clean):
 	$(MAKE) -C ${@:.clean=} clean
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/11] multipath-tools: Makefile.inc: separate out OPTFLAGS
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
  2020-05-11 22:39 ` [PATCH 01/11] multipath-tools: Makefile: more dependency fixes for parallel build mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 03/11] multipath-tools: Makefile.inc: allow user settings for LDFLAGS mwilck
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

OPTFLAGS is what distribution builds would typically override. That
should not include the warning flags we use.

Moreover, in the definition of CFLAGS, put $(CFLAGS) first to make it
easier for the user to spot her input in the build logs.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index d4d1e0dd..7a59db85 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -93,14 +93,14 @@ STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
 ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
 WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered,)
 
-OPTFLAGS	= -O2 -g -pipe -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
+OPTFLAGS	:= -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
+WARNFLAGS	:= -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
 		  -Werror=implicit-function-declaration -Werror=format-security \
-		  $(WNOCLOBBERED) \
-		  -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
-		  $(STACKPROT) --param=ssp-buffer-size=4
+		  $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
 CPPFLAGS	:= -Wp,-D_FORTIFY_SOURCE=2 
-CFLAGS		:= $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
-		   -MMD -MP $(CFLAGS)
+CFLAGS		:= $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
+		   -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
+		   -MMD -MP
 BIN_CFLAGS	= -fPIE -DPIE
 LIB_CFLAGS	= -fPIC
 SHARED_FLAGS	= -shared
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/11] multipath-tools: Makefile.inc: allow user settings for LDFLAGS
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
  2020-05-11 22:39 ` [PATCH 01/11] multipath-tools: Makefile: more dependency fixes for parallel build mwilck
  2020-05-11 22:39 ` [PATCH 02/11] multipath-tools: Makefile.inc: separate out OPTFLAGS mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 04/11] multipath-tools: Makefile.inc: set -Wno-error=clobbered mwilck
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

This allows e.g. setting LDFLAGS="-m32 -Wl,-b,elf32-i386" to compile
for a 32bit target on a 64bit system.

Note that, like CFLAGS, the variable needs to be set in the environment,
not on the "make" command line.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index 7a59db85..671dd1ca 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -104,7 +104,7 @@ CFLAGS		:= $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
 BIN_CFLAGS	= -fPIE -DPIE
 LIB_CFLAGS	= -fPIC
 SHARED_FLAGS	= -shared
-LDFLAGS		= -Wl,-z,relro -Wl,-z,now
+LDFLAGS		:= $(LDFLAGS) -Wl,-z,relro -Wl,-z,now
 BIN_LDFLAGS	= -pie
 
 # Check whether a function with name $1 has been declared in header file $2.
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/11] multipath-tools: Makefile.inc: set -Wno-error=clobbered
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (2 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 03/11] multipath-tools: Makefile.inc: allow user settings for LDFLAGS mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 05/11] libmultipath: discovery.c: use %z qualifier for size_t mwilck
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

We need to ignore -Wclobbered because gcc has trouble dealing with glibc's
implementation of pthread_cleanup_push().

For some variants of gcc, -Wno-clobbered alone isn't enough if -Werror is also
set. Compilation with -Wno-error=clobbered works, though.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index 671dd1ca..e7256e3a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -91,7 +91,7 @@ TEST_CC_OPTION = $(shell \
 
 STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
 ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
-WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered,)
+WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
 
 OPTFLAGS	:= -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
 WARNFLAGS	:= -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/11] libmultipath: discovery.c: use %z qualifier for size_t
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (3 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 04/11] multipath-tools: Makefile.inc: set -Wno-error=clobbered mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 06/11] libmultipath: eliminate more signed/unsigned comparisons mwilck
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Otherwise compilation for 32bit targets spits out warnings.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/discovery.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ee3290cd..ffec5162 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -986,7 +986,7 @@ parse_vpd_pg80(const unsigned char *in, char *out, size_t out_len)
 	}
 
 	if (len >= out_len) {
-		condlog(2, "vpd pg80 overflow, %lu/%lu bytes required",
+		condlog(2, "vpd pg80 overflow, %zu/%zu bytes required",
 			len + 1, out_len);
 		len = out_len - 1;
 	}
@@ -1087,7 +1087,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
 
 		len = sprintf(out, "%d", vpd_type);
 		if (2 * vpd_len >= out_len - len) {
-			condlog(1, "%s: WWID overflow, type %d, %lu/%lu bytes required",
+			condlog(1, "%s: WWID overflow, type %d, %zu/%zu bytes required",
 				__func__, vpd_type,
 				2 * vpd_len + len + 1, out_len);
 			vpd_len = (out_len - len - 1) / 2;
@@ -1096,7 +1096,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
 			len += sprintf(out + len,
 				       "%02x", vpd[i]);
 	} else if (vpd_type == 0x8 && vpd_len < 4) {
-		condlog(1, "%s: VPD length %lu too small for designator type 8",
+		condlog(1, "%s: VPD length %zu too small for designator type 8",
 			__func__, vpd_len);
 		return -EINVAL;
 	} else if (vpd_type == 0x8) {
@@ -1112,7 +1112,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
 		while (len > 2 && vpd[len - 2] == '\0')
 			--len;
 		if (len > out_len - 1) {
-			condlog(1, "%s: WWID overflow, type 8/%c, %lu/%lu bytes required",
+			condlog(1, "%s: WWID overflow, type 8/%c, %zu/%zu bytes required",
 				__func__, out[0], len + 1, out_len);
 			len = out_len - 1;
 		}
@@ -1136,7 +1136,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
 		while ((p = memchr(vpd, ' ', vpd_len))) {
 			p_len = p - vpd;
 			if (len + p_len > out_len - 1) {
-				condlog(1, "%s: WWID overflow, type 1, %lu/%lu bytes required",
+				condlog(1, "%s: WWID overflow, type 1, %zu/%zu bytes required",
 					__func__, len + p_len, out_len);
 				p_len = out_len - len - 1;
 			}
@@ -1162,7 +1162,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
 		p_len = vpd_len;
 		if (p_len > 0 && len < out_len - 1) {
 			if (len + p_len > out_len - 1) {
-				condlog(1, "%s: WWID overflow, type 1, %lu/%lu bytes required",
+				condlog(1, "%s: WWID overflow, type 1, %zu/%zu bytes required",
 					__func__, len + p_len + 1, out_len);
 				p_len = out_len - len - 1;
 			}
@@ -1186,14 +1186,14 @@ parse_vpd_c0_hp3par(const unsigned char *in, size_t in_len,
 
 	memset(out, 0x0, out_len);
 	if (in_len <= 4 || (in[4] > 3 && in_len < 44)) {
-		condlog(3, "HP/3PAR vendor specific VPD page length too short: %lu", in_len);
+		condlog(3, "HP/3PAR vendor specific VPD page length too short: %zu", in_len);
 		return -EINVAL;
 	}
 	if (in[4] <= 3) /* revision must be > 3 to have Vomlume Name */
 		return -ENODATA;
 	len = get_unaligned_be32(&in[40]);
 	if (len > out_len || len + 44 > in_len) {
-		condlog(3, "HP/3PAR vendor specific Volume name too long: %lu",
+		condlog(3, "HP/3PAR vendor specific Volume name too long: %zu",
 			len);
 		return -EINVAL;
 	}
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/11] libmultipath: eliminate more signed/unsigned comparisons
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (4 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 05/11] libmultipath: discovery.c: use %z qualifier for size_t mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 07/11] libmultipath: set_uint: fix parsing for 32bit mwilck
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Fix some more compiler warnings about signed/unsigned comparison.
I've observed these only on 32bit builds, therefore they went unnoticed
before.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmpathpersist/mpath_pr_ioctl.c      |  2 +-
 libmultipath/print.c                  | 12 ++++++------
 libmultipath/prioritizers/alua_spc3.h |  2 +-
 multipathd/cli_handlers.c             | 20 ++++++++++----------
 multipathd/main.c                     |  2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libmpathpersist/mpath_pr_ioctl.c b/libmpathpersist/mpath_pr_ioctl.c
index fadc9e10..126601c3 100644
--- a/libmpathpersist/mpath_pr_ioctl.c
+++ b/libmpathpersist/mpath_pr_ioctl.c
@@ -238,7 +238,7 @@ static void mpath_format_readfullstatus(struct prin_resp *pr_buff)
 	uint32_t additional_length, k, tid_len_len = 0;
 	char tempbuff[MPATH_MAX_PARAM_LEN];
 	struct prin_fulldescr fdesc;
-	static const int pbuf_size =
+	static const unsigned int pbuf_size =
 		sizeof(pr_buff->prin_descriptor.prin_readfd.private_buffer);
 
 	convert_be32_to_cpu(&pr_buff->prin_descriptor.prin_readfd.prgeneration);
diff --git a/libmultipath/print.c b/libmultipath/print.c
index b944ef32..298b3764 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1958,25 +1958,25 @@ char *snprint_config(const struct config *conf, int *len,
 		}
 
 		c = reply + snprint_defaults(conf, reply, maxlen);
-		if ((c - reply) == maxlen)
+		if (c == reply + maxlen)
 			continue;
 
 		c += snprint_blacklist(conf, c, reply + maxlen - c);
-		if ((c - reply) == maxlen)
+		if (c == reply + maxlen)
 			continue;
 
 		c += snprint_blacklist_except(conf, c, reply + maxlen - c);
-		if ((c - reply) == maxlen)
+		if (c == reply + maxlen)
 			continue;
 
 		c += snprint_hwtable(conf, c, reply + maxlen - c,
 				     hwtable ? hwtable : conf->hwtable);
-		if ((c - reply) == maxlen)
+		if (c == reply + maxlen)
 			continue;
 
 		c += snprint_overrides(conf, c, reply + maxlen - c,
 				       conf->overrides);
-		if ((c - reply) == maxlen)
+		if (c == reply + maxlen)
 			continue;
 
 		if (VECTOR_SIZE(conf->mptable) > 0 ||
@@ -1984,7 +1984,7 @@ char *snprint_config(const struct config *conf, int *len,
 			c += snprint_mptable(conf, c, reply + maxlen - c,
 					     mpvec);
 
-		if ((c - reply) < maxlen) {
+		if (c < reply + maxlen) {
 			if (len)
 				*len = c - reply;
 			return reply;
diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h
index 18b495ef..7ba2cf4c 100644
--- a/libmultipath/prioritizers/alua_spc3.h
+++ b/libmultipath/prioritizers/alua_spc3.h
@@ -284,7 +284,7 @@ struct rtpg_data {
 #define RTPG_FOR_EACH_PORT_GROUP(p, g) \
 		for( \
 			g = &(p->data[0]); \
-			(((char *) g) - ((char *) p)) < get_unaligned_be32(p->length); \
+			((char *) g) < ((char *) p) + get_unaligned_be32(p->length); \
 			g = (struct rtpg_tpg_dscr *) ( \
 				((char *) g) + \
 				sizeof(struct rtpg_tpg_dscr) + \
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 7d878c88..31c3d9fd 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -66,7 +66,7 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style,
 		c += snprint_foreign_paths(c, reply + maxlen - c,
 					   style, pretty);
 
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -102,7 +102,7 @@ show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
 
 		c += snprint_path(c, reply + maxlen - c, style, pp, 0);
 
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -131,7 +131,7 @@ show_map_topology (char ** r, int * len, struct multipath * mpp,
 		c = reply;
 
 		c += snprint_multipath_topology(c, reply + maxlen - c, mpp, 2);
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -171,7 +171,7 @@ show_maps_topology (char ** r, int * len, struct vectors * vecs)
 		}
 		c += snprint_foreign_topology(c, reply + maxlen - c, 2);
 
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -209,7 +209,7 @@ show_maps_json (char ** r, int * len, struct vectors * vecs)
 		c = reply;
 
 		c += snprint_multipath_topology_json(c, maxlen, vecs);
-		again = ((c - reply) == maxlen);
+		again = (c == reply + maxlen);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -238,7 +238,7 @@ show_map_json (char ** r, int * len, struct multipath * mpp,
 		c = reply;
 
 		c += snprint_multipath_map_json(c, maxlen, mpp);
-		again = ((c - reply) == maxlen);
+		again = (c == reply + maxlen);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -487,7 +487,7 @@ show_map (char ** r, int *len, struct multipath * mpp, char * style,
 		c += snprint_multipath(c, reply + maxlen - c, style,
 				       mpp, pretty);
 
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -533,7 +533,7 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style,
 		}
 		c += snprint_foreign_multipaths(c, reply + maxlen - c,
 						style, pretty);
-		again = ((c - reply) == (maxlen - 1));
+		again = (c == reply + maxlen - 1);
 
 		REALLOC_REPLY(reply, again, maxlen);
 	}
@@ -1297,7 +1297,7 @@ show_blacklist (char ** r, int * len)
 
 		c = reply;
 		c += snprint_blacklist_report(conf, c, maxlen);
-		again = ((c - reply) == maxlen);
+		again = (c == reply + maxlen);
 		REALLOC_REPLY(reply, again, maxlen);
 	}
 	pthread_cleanup_pop(1);
@@ -1339,7 +1339,7 @@ show_devices (char ** r, int * len, struct vectors *vecs)
 
 		c = reply;
 		c += snprint_devices(conf, c, maxlen, vecs);
-		again = ((c - reply) == maxlen);
+		again = (c == reply + maxlen);
 		REALLOC_REPLY(reply, again, maxlen);
 	}
 	pthread_cleanup_pop(1);
diff --git a/multipathd/main.c b/multipathd/main.c
index 8baf9abe..6b7db2c0 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2374,7 +2374,7 @@ checkerloop (void *ap)
 				conf = get_multipath_config();
 				max_checkint = conf->max_checkint;
 				put_multipath_config(conf);
-				if (diff_time.tv_sec > max_checkint)
+				if (diff_time.tv_sec > (time_t)max_checkint)
 					condlog(1, "path checkers took longer "
 						"than %lu seconds, consider "
 						"increasing max_polling_interval",
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/11] libmultipath: set_uint: fix parsing for 32bit
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (5 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 06/11] libmultipath: eliminate more signed/unsigned comparisons mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 08/11] multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS mwilck
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

On architectures where sizeof(long) == sizeof(int), the code wouldn't
work as intended. Use strtoul instead. As strtoul happily parses
negative numbers as input, require the number to begin with a digit.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/dict.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 3e25e74f..0e9ea387 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -60,19 +60,22 @@ static int
 set_uint(vector strvec, void *ptr)
 {
 	unsigned int *uint_ptr = (unsigned int *)ptr;
-	char *buff, *eptr;
-	long res;
+	char *buff, *eptr, *p;
+	unsigned long res;
 	int rc;
 
 	buff = set_value(strvec);
 	if (!buff)
 		return 1;
 
-	res = strtol(buff, &eptr, 10);
+	p = buff;
+	while (isspace(*p))
+		p++;
+	res = strtoul(p, &eptr, 10);
 	if (eptr > buff)
 		while (isspace(*eptr))
 			eptr++;
-	if (*buff == '\0' || *eptr != '\0' || res < 0 || res > UINT_MAX) {
+	if (*buff == '\0' || *eptr != '\0' || !isdigit(*p) || res > UINT_MAX) {
 		condlog(1, "%s: invalid value for %s: \"%s\"",
 			__func__, (char*)VECTOR_SLOT(strvec, 0), buff);
 		rc = 1;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/11] multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (6 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 07/11] libmultipath: set_uint: fix parsing for 32bit mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 09/11] multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test mwilck
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Make sure the linker finds libmpathcmd.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile b/tests/Makefile
index 77ff3249..028c9ea7 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,7 +10,7 @@ W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)
 
 CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) \
 	-Wno-unused-parameter $(W_MISSING_INITIALIZERS)
-LIBDEPS += -L$(multipathdir) -lmultipath -lcmocka
+LIBDEPS += -L$(multipathdir) -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka
 
 TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
 	 alias directio
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/11] multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (7 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 08/11] multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 10/11] multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign mwilck
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

OBJDEPS needs to list object files that _call_ functions we want
to wrap, but it should _not_ list the object files where these
functions are defined; otherwise the linker might resolve these
symbols before they can be wrapped.

(Observed on i586 with gcc 9.3.1, ld 2.34.0, where wrapping
prio_getprio() doesn't work with prio.o in OBJDEPS).

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Makefile b/tests/Makefile
index 028c9ea7..1b8706a7 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -41,7 +41,7 @@ endif
 dmevents-test_LIBDEPS = -lpthread -ldevmapper -lurcu
 hwtable-test_TESTDEPS := test-lib.o
 hwtable-test_OBJDEPS := ../libmultipath/discovery.o ../libmultipath/blacklist.o \
-	../libmultipath/prio.o ../libmultipath/callout.o ../libmultipath/structs.o
+	../libmultipath/structs.o
 hwtable-test_LIBDEPS := -ludev -lpthread -ldl
 blacklist-test_TESTDEPS := test-log.o
 blacklist-test_OBJDEPS := ../libmultipath/blacklist.o
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/11] multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (8 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 09/11] multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-11 22:39 ` [PATCH 11/11] multipath-tools tests/directio: fix -Wmaybe-uninitalized warning mwilck
  2020-05-15  1:30 ` [PATCH 00/11] Minor fixes for multipath-tools Benjamin Marzinski
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

is_claimed_by_foreign() is an inline function and can't be wrapped.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/test-lib.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/tests/test-lib.c b/tests/test-lib.c
index 59275163..00bae58e 100644
--- a/tests/test-lib.c
+++ b/tests/test-lib.c
@@ -56,12 +56,6 @@ int __wrap_execute_program(char *path, char *value, int len)
 	return 0;
 }
 
-bool __wrap_is_claimed_by_foreign(struct udev_device *ud)
-{
-	condlog(5, "%s: %p", __func__, ud);
-	return false;
-}
-
 struct udev_list_entry
 *__wrap_udev_device_get_properties_list_entry(struct udev_device *ud)
 {
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 11/11] multipath-tools tests/directio: fix -Wmaybe-uninitalized warning
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (9 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 10/11] multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign mwilck
@ 2020-05-11 22:39 ` mwilck
  2020-05-15  1:30 ` [PATCH 00/11] Minor fixes for multipath-tools Benjamin Marzinski
  11 siblings, 0 replies; 13+ messages in thread
From: mwilck @ 2020-05-11 22:39 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Initialize aio_grp to satisfy gcc.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 tests/directio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/directio.c b/tests/directio.c
index 3cd7a520..66aaf0eb 100644
--- a/tests/directio.c
+++ b/tests/directio.c
@@ -316,7 +316,7 @@ static void test_init_free(void **state)
 {
 	int i, count = 0;
 	struct checker c[4096] = {0};
-	struct aio_group *aio_grp;
+	struct aio_group *aio_grp = NULL;
 
 	assert_true(list_empty(&aio_grp_list));
 	will_return(__wrap_io_setup, 0);
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 00/11] Minor fixes for multipath-tools
  2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
                   ` (10 preceding siblings ...)
  2020-05-11 22:39 ` [PATCH 11/11] multipath-tools tests/directio: fix -Wmaybe-uninitalized warning mwilck
@ 2020-05-15  1:30 ` Benjamin Marzinski
  11 siblings, 0 replies; 13+ messages in thread
From: Benjamin Marzinski @ 2020-05-15  1:30 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Tue, May 12, 2020 at 12:39:20AM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> Hi Christophe, hi Ben,
> 
> This series fixes a couple of issues I recently found with the 32bit build
> of multipath-tools, and after integrating our CI into the automated builds
> on our build server.
> 
> Regards
> Martin

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>

For the set.

> 
> Martin Wilck (11):
>   multipath-tools: Makefile: more dependency fixes for parallel build
>   multipath-tools: Makefile.inc: separate out OPTFLAGS
>   multipath-tools: Makefile.inc: allow user settings for LDFLAGS
>   multipath-tools: Makefile.inc: set -Wno-error=clobbered
>   libmultipath: discovery.c: use %z qualifier for size_t
>   libmultipath: eliminate more signed/unsigned comparisons
>   libmultipath: set_uint: fix parsing for 32bit
>   multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS
>   multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test
>   multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign
>   multipath-tools tests/directio: fix -Wmaybe-uninitalized warning
> 
>  Makefile                              |  5 +++--
>  Makefile.inc                          | 16 ++++++++--------
>  libmpathpersist/mpath_pr_ioctl.c      |  2 +-
>  libmultipath/dict.c                   | 11 +++++++----
>  libmultipath/discovery.c              | 16 ++++++++--------
>  libmultipath/print.c                  | 12 ++++++------
>  libmultipath/prioritizers/alua_spc3.h |  2 +-
>  multipathd/cli_handlers.c             | 20 ++++++++++----------
>  multipathd/main.c                     |  2 +-
>  tests/Makefile                        |  4 ++--
>  tests/directio.c                      |  2 +-
>  tests/test-lib.c                      |  6 ------
>  12 files changed, 48 insertions(+), 50 deletions(-)
> 
> -- 
> 2.26.2

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-15  1:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 22:39 [PATCH 00/11] Minor fixes for multipath-tools mwilck
2020-05-11 22:39 ` [PATCH 01/11] multipath-tools: Makefile: more dependency fixes for parallel build mwilck
2020-05-11 22:39 ` [PATCH 02/11] multipath-tools: Makefile.inc: separate out OPTFLAGS mwilck
2020-05-11 22:39 ` [PATCH 03/11] multipath-tools: Makefile.inc: allow user settings for LDFLAGS mwilck
2020-05-11 22:39 ` [PATCH 04/11] multipath-tools: Makefile.inc: set -Wno-error=clobbered mwilck
2020-05-11 22:39 ` [PATCH 05/11] libmultipath: discovery.c: use %z qualifier for size_t mwilck
2020-05-11 22:39 ` [PATCH 06/11] libmultipath: eliminate more signed/unsigned comparisons mwilck
2020-05-11 22:39 ` [PATCH 07/11] libmultipath: set_uint: fix parsing for 32bit mwilck
2020-05-11 22:39 ` [PATCH 08/11] multipath-tools tests/Makefile: add -lmpathcmd to LIBDEPS mwilck
2020-05-11 22:39 ` [PATCH 09/11] multipath tools tests/Makefile: Fix OBJDEPS for hwtable-test mwilck
2020-05-11 22:39 ` [PATCH 10/11] multipath-tools tests/test-lib.c: drop __wrap_is_claimed_by_foreign mwilck
2020-05-11 22:39 ` [PATCH 11/11] multipath-tools tests/directio: fix -Wmaybe-uninitalized warning mwilck
2020-05-15  1:30 ` [PATCH 00/11] Minor fixes for multipath-tools Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.