From: Ulrich Drepper Date: Tue, 14 May 2002 21:41:26 +0000 (+0000) Subject: (__posix_memalign): Correct check for size of alignment value. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61ea97abdf8fcb7fb97d494b9f15b76502dbe407;p=thirdparty%2Fglibc.git (__posix_memalign): Correct check for size of alignment value. --- diff --git a/malloc/malloc.c b/malloc/malloc.c index 8279ddaf22e..db65535e49a 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1,5 +1,5 @@ /* Malloc implementation for multiple threads without lock contention. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Wolfram Gloger and Doug Lea , 1996. @@ -4899,9 +4899,9 @@ __posix_memalign (void **memptr, size_t alignment, size_t size) { void *mem; - /* 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) + /* Test whether the ALIGNMENT argument is valid. It must be a power + of two multiple of sizeof (void *). */ + if (alignment % sizeof (void *) != 0 || (alignment & (alignment - 1)) != 0) return EINVAL; mem = __libc_memalign (alignment, size);