From: Josh Boyer <jwboyer@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
law@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2] posix_types.h: make __NFDBITS compatible with glibc definition
Date: Tue, 24 Jul 2012 14:32:31 -0400 [thread overview]
Message-ID: <20120724183230.GC10534@zod.bos.redhat.com> (raw)
In-Reply-To: <20120724182409.GB10534@zod.bos.redhat.com>
Recent glibc made a change to suppress sign-conversion warnings from FD_SET
(glibc commit ceb9e56b3d1). That patch solved the particular error it was
aiming to, however applications that #include <linux/types.h> after
including <sys/select.h> can now hit a build failure if -Werror=sign-compare
and -D_FORTIFY_SOURCE=2 is passed to gcc. This can be seen when building
this trivial application against a recent enough glibc:
| #include <sys/select.h>
| #include <linux/types.h>
|
| int main(int argc, char **argv)
| {
| fd_set fds;
| FD_ZERO(&fds);
| FD_SET(0, &fds);
| return FD_ISSET(0, &fds);
| }
It was suggested the kernel should either match the glibc definition of
__NFDBITS in linux/posix_types.h or remove it entirely. Given that we
don't know what applications may be relying on the header having a
definition, we make our definition compatible with glibc.
This resolves https://bugzilla.redhat.com/show_bug.cgi?id=837641
Reported-by: Jeff Law <law@redhat.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
---
v2: Avoid the type change to long int
include/linux/posix_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..0bfc9cc 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -19,7 +19,7 @@
* use the ones here.
*/
#undef __NFDBITS
-#define __NFDBITS (8 * sizeof(unsigned long))
+#define __NFDBITS (8 * (int) sizeof(unsigned long))
#undef __FD_SETSIZE
#define __FD_SETSIZE 1024
--
1.7.10.4
next prev parent reply other threads:[~2012-07-24 18:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 18:12 [PATCH] posix_types.h: make __NFDBITS match " Josh Boyer
2012-07-24 18:20 ` Linus Torvalds
2012-07-24 18:24 ` Josh Boyer
2012-07-24 18:32 ` Josh Boyer [this message]
2012-07-24 18:46 ` [PATCH v2] posix_types.h: make __NFDBITS compatible with " Linus Torvalds
2012-07-24 19:03 ` Josh Boyer
2012-07-24 19:09 ` Linus Torvalds
2012-07-24 19:15 ` Jeff Law
2012-07-24 19:24 ` Linus Torvalds
2012-07-24 19:26 ` Jeff Law
2012-07-24 19:43 ` Josh Boyer
2012-07-24 19:55 ` Linus Torvalds
2012-07-24 20:10 ` Josh Boyer
2012-07-24 20:13 ` Linus Torvalds
2012-07-24 20:02 ` Andreas Schwab
2012-07-24 19:43 ` Linus Torvalds
2012-07-24 20:01 ` Jeff Law
2012-07-24 19:19 ` [PATCH] posix_types.h: make __NFDBITS match " Jeff Law
2012-07-24 19:37 ` Linus Torvalds
2012-07-24 19:39 ` Linus Torvalds
2012-07-24 19:41 ` Josh Boyer
2012-07-24 19:59 ` Linus Torvalds
2012-07-24 20:11 ` Linus Torvalds
2012-07-24 20:52 ` Andreas Schwab
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=20120724183230.GC10534@zod.bos.redhat.com \
--to=jwboyer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=law@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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
Powered by JetHome