[ipxe-devel] [PATCH v1 1/2] memtop_umalloc: fix "out of memory" detection when expanding bottom arena

David Decotigny decot+ext at google.com
Wed Jan 15 08:19:40 UTC 2020


From: David Decotigny <ddecotig at gmail.com>


---
 src/arch/x86/interface/pcbios/memtop_umalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/arch/x86/interface/pcbios/memtop_umalloc.c b/src/arch/x86/interface/pcbios/memtop_umalloc.c
index f1ab73e2..d7b82189 100644
--- a/src/arch/x86/interface/pcbios/memtop_umalloc.c
+++ b/src/arch/x86/interface/pcbios/memtop_umalloc.c
@@ -190,7 +190,7 @@ static userptr_t memtop_urealloc ( userptr_t ptr, size_t new_size ) {
 	/* Expand/shrink block if possible */
 	if ( ptr == bottom ) {
 		/* Update block */
-		if ( new_size > ( heap_size - extmem.size ) ) {
+		if ( new_size > ( heap_size + extmem.size ) ) {
 			DBG ( "EXTMEM out of space\n" );
 			return UNULL;
 		}
-- 
2.25.0.rc1.283.g88dfdc4193-goog




More information about the ipxe-devel mailing list