diff options
author | Nico Huber <nico.huber@secunet.com> | 2012-11-22 17:37:32 +0100 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-11-23 18:17:08 +0100 |
commit | 7a32e88f12efcc424a8e33de0f33f82356d73531 (patch) | |
tree | 80957a5dbbc2a3411ffcdab80ea0266c1425e27b /payloads/libpayload/libc/malloc.c | |
parent | 0a3f2393aefd8fceea075e3108d581aadec292ab (diff) | |
download | coreboot-7a32e88f12efcc424a8e33de0f33f82356d73531.tar.xz |
libpayload: Fix memalign() for fragmented alignment regions
Found a bug in the memory allocator ;-)
If the total free space in an alignment region is large enough for an
allocation but fragmented, such that there is no contiguous, sufficient
large, free space in the region, memalign() was looking at the same
region again and again in an endless loop. The advancing to the next
region was just missing.
Change-Id: I3fad833804675ee495577ca2749b007f46b5ff69
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/1906
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload/libc/malloc.c')
-rw-r--r-- | payloads/libpayload/libc/malloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c index 3c5a3fd2a2..82bae3c66e 100644 --- a/payloads/libpayload/libc/malloc.c +++ b/payloads/libpayload/libc/malloc.c @@ -387,6 +387,9 @@ look_further: count = 0; } } + /* The free space in this region is fragmented, + so we will move on and try the next one: */ + reg = reg->next; goto look_further; // end condition is once a new region is allocated - it always has enough space } |