On 11/4/2012 19:00, Shao Miller wrote:> In Syslinux-5.00, is the goal that the core and .c32 modules alike will use
> the same heap? There is a bug I am thinking about:
>
> - QEmu with 1024 MiB RAM
> - Syslinux 4.06
> - .c32 can realloc() up to 1013 MiB
>
> - QEmu with 1024 MiB RAM
> - Syslinux 5.00-pre9
> - .c32 can realloc() up to 45 MiB
>
> I am wondering if there's a maximum-allocation-size being hit, or if
it's
> actually a bug I should look for.
Nevermind. 'git format-patch' patch attached and below. - Shao
-----
From 0b505cfaa718e68e70611ff5700747c3c3191e46 Mon Sep 17 00:00:00 2001
From: Shao Miller <sha0.miller at gmail.com>
Date: Sun, 4 Nov 2012 21:23:09 -0500
Subject: [PATCH] core: Fix realloc() code transcription error
Commit 79459f631546eea83d4158f535c20ebd4ac18987 copied portions of
com32/lib/realloc.c into core/mem/malloc.c, with minor changes
for accessing allocation arena header attributes. The previous
code used structure members and the current code uses bitmask
macros.
On a particular line in the original realloc(), there were two
assignments in a single expression. This fact was missed when the
code was copied and modified to use the bitmask macros.
Signed-off-by: Shao Miller <sha0.miller at gmail.com>
---
core/mem/malloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index fa1d26a..1968172 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -152,9 +152,9 @@ void *realloc(void *ptr, size_t size)
ah->a.next->a.prev = ah;
nah->next_free->prev_free = nah->prev_free;
nah->prev_free->next_free = nah->next_free;
- ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(nah->a.attrs));
+ ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(ah->a.attrs) +
+ ARENA_SIZE_GET(nah->a.attrs));
xsize = ARENA_SIZE_GET(ah->a.attrs);
- //xsize = (ah->a.size += nah->a.size);
}
if (xsize >= newsize) {
--
1.7.11.7
-------------- next part -------------->From 0b505cfaa718e68e70611ff5700747c3c3191e46 Mon Sep 17 00:00:00 2001
From: Shao Miller <sha0.miller at gmail.com>
Date: Sun, 4 Nov 2012 21:23:09 -0500
Subject: [PATCH] core: Fix realloc() code transcription error
Commit 79459f631546eea83d4158f535c20ebd4ac18987 copied portions of
com32/lib/realloc.c into core/mem/malloc.c, with minor changes
for accessing allocation arena header attributes. The previous
code used structure members and the current code uses bitmask
macros.
On a particular line in the original realloc(), there were two
assignments in a single expression. This fact was missed when the
code was copied and modified to use the bitmask macros.
Signed-off-by: Shao Miller <sha0.miller at gmail.com>
---
core/mem/malloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index fa1d26a..1968172 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -152,9 +152,9 @@ void *realloc(void *ptr, size_t size)
ah->a.next->a.prev = ah;
nah->next_free->prev_free = nah->prev_free;
nah->prev_free->next_free = nah->next_free;
- ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(nah->a.attrs));
+ ARENA_SIZE_SET(ah->a.attrs, ARENA_SIZE_GET(ah->a.attrs) +
+ ARENA_SIZE_GET(nah->a.attrs));
xsize = ARENA_SIZE_GET(ah->a.attrs);
- //xsize = (ah->a.size += nah->a.size);
}
if (xsize >= newsize) {
--
1.7.11.7