summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-06-15 21:12:57 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-15 21:12:57 -0700
commit395a37e379bf900b2b6a25e17c44cde2d1c46c44 (patch)
tree7c52b4a022f69e8fd8de07744f130f3c6dfd5318
parent7ed520bd8504700cf4aaf3b06deb10575bfc546a (diff)
downloadglibc-395a37e379bf900b2b6a25e17c44cde2d1c46c44.tar.gz
glibc-395a37e379bf900b2b6a25e17c44cde2d1c46c44.tar.xz
glibc-395a37e379bf900b2b6a25e17c44cde2d1c46c44.zip
When iterating over CPU bitmask, don't try more than CPU_SETSIZE.
-rw-r--r--ChangeLog3
-rw-r--r--posix/tst-cpucount.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b4f7524aef..a431f3914c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-06-15  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #10183]
+	* posix/tst-cpucount.c: Don't try more than CPU_SETSIZE bits.
+
 	[BZ #10195]
 	* inet/netinet/icmp6.h (struct nd_opt_home_agent_info): Change type
 	of nd_opt_home_agent_info_preference to uint16_t.
diff --git a/posix/tst-cpucount.c b/posix/tst-cpucount.c
index fe3cded732..b3691a18da 100644
--- a/posix/tst-cpucount.c
+++ b/posix/tst-cpucount.c
@@ -1,5 +1,6 @@
 #include <sched.h>
 #include <stdio.h>
+#include <sys/param.h>
 
 static int
 do_test (void)
@@ -8,7 +9,7 @@ do_test (void)
 
   CPU_ZERO (&c);
 
-  for (int cnt = 0; cnt < 130; ++cnt)
+  for (int cnt = 0; cnt < MIN (CPU_SETSIZE, 130); ++cnt)
     {
       int n = CPU_COUNT (&c);
       if (n != cnt)