[PATCH] malloc.c fix for MALLOC_ALIGN_MASK tests.

Peter Bergner bergner@vnet.ibm.com
Thu Sep 15 18:22:00 GMT 2005


On Thu, 2005-09-15 at 10:30 -0700, Ulrich Drepper wrote:
> Look at the definition of mem2chunk.  It doesn't change the alignment.
> MALLOC_ALIGNMENT is 2*SIZE_SZ and just subtracts 2*SIZE_SZ.  So, state
> what your problem with the existing code is.

I'm sorry if I wasn't clear enough.  The problem occurs on arches that
define MALLOC_ALIGNMENT > 2*SIZE_SZ.  In that case, the chunk pointer
will not be aligned to MALLOC_ALIGNMENT since mem2chunk just subtracts
2*SIZE_SZ.  This means we cannot test whether our mem pointer is
properly aligned by testing its chunk pointer.  We need to test the
mem pointer directly.

Peter




More information about the Libc-alpha mailing list