aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-05 17:24:44 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-05 17:24:44 -0700
commit5662188616aa006d48e19f431639e0db8c08da64 (patch)
treee545cce01b2af5259a0297169efc3a12cd724f4c
parenteb04727532a80e6119a8a90282e2c3f7be8a8564 (diff)
downloadsyslinux-elf-5662188616aa006d48e19f431639e0db8c08da64.tar.gz
syslinux-elf-5662188616aa006d48e19f431639e0db8c08da64.tar.xz
syslinux-elf-5662188616aa006d48e19f431639e0db8c08da64.zip
elflink: allow small alignment to posix_memalign()
POSIX says the smallest permitted alignment passed to posix_memalign() is sizeof(void *). It doesn't make any sense, however, so for our purpose, just ignore it (we'll round up the alignment anyway by pure necessity.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/malloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/com32/lib/malloc.c b/com32/lib/malloc.c
index 235ffa62..405e6435 100644
--- a/com32/lib/malloc.c
+++ b/com32/lib/malloc.c
@@ -179,9 +179,11 @@ int posix_memalign(void **memptr, size_t alignment, size_t size)
if ((alignment & (alignment - 1)) != 0)
return EINVAL;
+#if 0
// POSIX says to refuse alignments smaller than sizeof(void*)
if (alignment % sizeof(void*) != 0)
return EINVAL;
+#endif
// The arena allocator can't handle alignments smaller than this
if (alignment < sizeof(struct arena_header)) {