[syslinux] [PATCH] syslinux/core: Remove discrepancy between code comments and compiled code in malloc.h

Brett Walker brett.walker at geometry.com.au
Tue Feb 6 01:16:11 PST 2018

From: Brett Walker <brett.walker at geometry.com.au>

Remove a discrepancy between code comments and the definition for arena_header,
ARENA_PADDING and free_arena_header.

When the size of int and pointer are both 32-bits; and compiled with
DEBUG_MALLOC undefined; the following are true: sizeof(arena_header) == 16
and sizeof(free_arena_header) == 56.

To correct this, the type of _pad needs to be changed from size_t to uint8_t.
This will make sizeof(free_arena_header) == 32.

Signed-off-by: Brett Walker <brett.walker at geometry.com.au>


--- syslinux/core/mem/malloc.h.orig
+++ syslinux/core/mem/malloc.h
@@ -69,7 +69,7 @@ struct arena_header {
 struct free_arena_header {
     struct arena_header a;
     struct free_arena_header *next_free, *prev_free;
-    size_t _pad[ARENA_PADDING];
+    uint8_t _pad[ARENA_PADDING];

 #define ARENA_SIZE_MASK (~(uintptr_t)(sizeof(struct arena_header)-1))

More information about the Syslinux mailing list