about summary refs log tree commit diff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4057f56132..d588941159 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5273,6 +5273,7 @@ int mALLOPt(param_number, value) int param_number; int value;
 
 
 #ifdef _LIBC
+# include <sys/param.h>
 
 /* We need a wrapper function for one of the additions of POSIX.  */
 int
@@ -5282,7 +5283,7 @@ __posix_memalign (void **memptr, size_t alignment, size_t size)
 
   /* Test whether the SIZE argument is valid.  It must be a power of
      two multiple of sizeof (void *).  */
-  if (size % sizeof (void *) != 0 || (size & (size - 1)) != 0)
+  if (alignment % sizeof (void *) != 0 || !powerof2 (alignment) != 0)
     return EINVAL;
 
   mem = __libc_memalign (alignment, size);