[syslinux:master] efi: Suspicious size reduction in emalloc

syslinux-bot for Sylvain Gault sylvain.gault at gmail.com
Thu Feb 13 15:42:04 PST 2014


Commit-ID:  e6374f1c88f925bd01212a783680eda928ecfff9
Gitweb:     http://www.syslinux.org/commit/e6374f1c88f925bd01212a783680eda928ecfff9
Author:     Sylvain Gault <sylvain.gault at gmail.com>
AuthorDate: Thu, 13 Feb 2014 03:20:05 +0100
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 13 Feb 2014 15:39:20 -0800

efi: Suspicious size reduction in emalloc

It could happen on 32 bits architecture that the memory size really allocated
could be less than required. On 64 bits, allocate_pages may be called
more times than needed.

This closes bug #39.

Signed-off-by: Sylvain Gault <sylvain.gault at gmail.com>
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 efi/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/efi/main.c b/efi/main.c
index 0e6b137..94878f9 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -691,10 +691,8 @@ EFI_STATUS emalloc(UINTN size, UINTN align, EFI_PHYSICAL_ADDRESS *addr)
 		/* Low-memory is super-precious! */
 		if (end <= 1 << 20)
 			continue;
-		if (start < 1 << 20) {
-			size -= (1 << 20) - start;
+		if (start < 1 << 20)
 			start = (1 << 20);
-		}
 
 		aligned = (start + align -1) & ~(align -1);
 


More information about the Syslinux-commits mailing list