]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[pcbios] Fix "out of memory" detection when expanding bottom area
authorDavid Decotigny <ddecotig@gmail.com>
Wed, 15 Jan 2020 07:31:03 +0000 (23:31 -0800)
committerMichael Brown <mcb30@ipxe.org>
Tue, 21 Jul 2020 13:50:24 +0000 (14:50 +0100)
This caused iPXE to reject images even when enough memory was
available.

Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/interface/pcbios/memtop_umalloc.c

index f1ab73e297e97c5be340ffd60b1a6171ae584053..d7b82189a7e5b7a4a431d2ab96735d8d87029fc8 100644 (file)
@@ -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;
                }