Nico Huber (nico.huber@secunet.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1906
-gerrit
commit 27a999df2944c153900fb9567e76d17cf299ca13 Author: Nico Huber nico.huber@secunet.com Date: Thu Nov 22 17:37:32 2012 +0100
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 --- payloads/libpayload/libc/malloc.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c index 3c5a3fd..82bae3c 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 }