dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	Martin Wilck <Martin.Wilck@suse.com>
Subject: [dm-devel] [PATCH 5/5] libmultipath: deal with dynamic PTHREAD_STACK_MIN
Date: Thu, 29 Jul 2021 16:46:05 -0500	[thread overview]
Message-ID: <1627595165-19980-6-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1627595165-19980-1-git-send-email-bmarzins@redhat.com>

Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined
as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf()
returns a long and can, at least in theory, return -1.  This change
causes compilation to fail in setup_thread_attr() due to a comparision
with different signedness, since stacksize is a size_t.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libmultipath/util.c b/libmultipath/util.c
index e2fafe85..ea858409 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -223,8 +223,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
 
 	ret = pthread_attr_init(attr);
 	assert(ret == 0);
-	if (stacksize < PTHREAD_STACK_MIN)
-		stacksize = PTHREAD_STACK_MIN;
+	if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN)
+		stacksize = (size_t)PTHREAD_STACK_MIN;
 	ret = pthread_attr_setstacksize(attr, stacksize);
 	assert(ret == 0);
 	if (detached) {
-- 
2.17.2

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


  parent reply	other threads:[~2021-07-29 21:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 21:46 [dm-devel] [PATCH 0/5] Mulitpath: miscellaneous patches Benjamin Marzinski
2021-07-29 21:46 ` [dm-devel] [PATCH 1/5] multipath.conf: fix typo in ghost_delay description Benjamin Marzinski
2021-08-12 10:22   ` Martin Wilck
2021-07-29 21:46 ` [dm-devel] [PATCH 2/5] mpathpersist: fail commands when no usable paths exist Benjamin Marzinski
2021-08-12 10:23   ` Martin Wilck
2021-07-29 21:46 ` [dm-devel] [PATCH 3/5] multipath: print warning if multipathd is not running Benjamin Marzinski
2021-08-12 10:23   ` Martin Wilck
2021-08-30 21:28     ` Benjamin Marzinski
2021-07-29 21:46 ` [dm-devel] [PATCH 4/5] libmultipath: remove unneeded code in coalesce_paths Benjamin Marzinski
2021-08-12 10:23   ` Martin Wilck
2021-07-29 21:46 ` Benjamin Marzinski [this message]
2021-08-12 10:23   ` [dm-devel] [PATCH 5/5] libmultipath: deal with dynamic PTHREAD_STACK_MIN Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1627595165-19980-6-git-send-email-bmarzins@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=Martin.Wilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).