From de02bd0553bd50e457f351a1cc8d730b0e3990f9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 19 Mar 2004 07:16:54 +0000 Subject: [PATCH] Update. 2004-03-18 Ulrich Drepper * malloc/malloc.c (__posix_memalign): Correct alignment check. Reported by Don Heller . --- ChangeLog | 5 +++++ malloc/malloc.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a91b641..a339199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-03-18 Ulrich Drepper + + * malloc/malloc.c (__posix_memalign): Correct alignment check. + Reported by Don Heller . + 2004-03-18 Jakub Jelinek * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Remove hwcap diff --git a/malloc/malloc.c b/malloc/malloc.c index 4839262..6cac7d4 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -5418,7 +5418,9 @@ __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 (alignment % sizeof (void *) != 0 || !powerof2 (alignment) != 0) + if (alignment % sizeof (void *) != 0 + || !powerof2 (alignment / sizeof (void *)) != 0 + || alignment == 0) return EINVAL; /* Call the hook here, so that caller is posix_memalign's caller -- 2.7.4