From: Paul Floyd Date: Sun, 5 Mar 2023 15:30:44 +0000 (+0100) Subject: Linux musl: alligned_alloc accepts alignment of zero X-Git-Tag: VALGRIND_3_21_0~144 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=dc8af61b5a6dbf0b3887ff09f194a38e12c5c3cc;p=valgrind.git Linux musl: alligned_alloc accepts alignment of zero --- diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index b00d33d497..c781da5989 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -1938,6 +1938,11 @@ extern int *___errno (void) __attribute__((weak)); #define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0 #endif +#if defined(MUSL_LIBC) +#define VG_ALIGNED_ALLOC_SIZE_ZERO 0 +#else +#define VG_ALIGNED_ALLOC_SIZE_ZERO 1 +#endif #if defined (VGO_linux) && !defined(MUSL_LIBC) @@ -1979,7 +1984,7 @@ extern int *___errno (void) __attribute__((weak)); \ MALLOC_TRACE("aligned_alloc(al %llu, size %llu)", \ (ULong)alignment, (ULong)size ); \ - if (alignment == 0 \ + if (VG_ALIGNED_ALLOC_SIZE_ZERO && (alignment == 0) \ || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && (size % alignment != 0)) \ || (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \ || (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (alignment % 4 != 0))) { \