This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove `attr != NULL' assert in allocate_stack.

The allocate_stack function is an internal function that is used
only by glibc and only from pthread_create. We don't need an
assert on a value we control and we know to be non-NULL. Just
like we don't assert that pdp is non-NULL, or any other number
of input arguments we control entirely.

However, the function does need documenting that neither of
the input arguments should be NULL.

No regressions on x86_64.

OK to commit?

2012-01-10  Carlos O'Donell  <>

	* allocatestack.c (allocate_stack): Remove assert for attr.

diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index d1056ee..31c8829 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -340,6 +340,10 @@ change_stack_perm (struct pthread *pd
+/* Returns a usable stack for a new thread either by allocating a
+   new stack or reusing a cached stack of sufficient size.
+   ATTR must be non-NULL and point to a valid pthread_attr.
+   PDP must be non-NULL.  */
 static int
 allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
@@ -349,7 +353,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
   size_t pagesize_m1 = __getpagesize () - 1;
   void *stacktop;
-  assert (attr != NULL);
   assert (powerof2 (pagesize_m1 + 1));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]