]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
When iterating over CPU bitmask, don't try more than CPU_SETSIZE.
authorUlrich Drepper <drepper@redhat.com>
Tue, 16 Jun 2009 04:12:57 +0000 (21:12 -0700)
committerPetr Baudis <pasky@suse.cz>
Tue, 16 Jun 2009 10:23:11 +0000 (12:23 +0200)
(cherry picked from commit 395a37e379bf900b2b6a25e17c44cde2d1c46c44)

ChangeLog
posix/tst-cpucount.c

index d0912cccaf22cb6ef624e26e8a189ac02c072996..b1ba1459f8d7b32dab3e1fb394bf5b71a209981b 100644 (file)
--- 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.
index fe3cded732bc3c5b5f10cb81e1a83dff098cd2f9..b3691a18da742799616256f223377270d0667447 100644 (file)
@@ -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)