grub2/0003-grub-core-loader-i386-linux.c-find_efi_mmap_size-Don.patch
2013-05-02 16:54:52 -04:00

58 lines
1.7 KiB
Diff

From ec6a8c449294b215a2c4019f42110a0c1f770ac2 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Mon, 2 Jul 2012 11:14:37 +0200
Subject: [PATCH 003/364] * grub-core/loader/i386/linux.c
(find_efi_mmap_size): Don't decrease efi_mmap_size. Reported by: Stuart
Hayes.
---
ChangeLog | 6 ++++++
grub-core/loader/i386/linux.c | 7 +++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f6e864a..53ad372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-02 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/loader/i386/linux.c (find_efi_mmap_size): Don't decrease
+ efi_mmap_size.
+ Reported by: Stuart Hayes.
+
2012-06-28 Vladimir Serbinenko <phcoder@gmail.com>
Add monochrome text support (mda_text, aka `hercules' in grub-legacy).
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 62087cf..d34b2f8 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -118,12 +118,13 @@ find_efi_mmap_size (void)
int ret;
grub_efi_memory_descriptor_t *mmap;
grub_efi_uintn_t desc_size;
+ grub_efi_uintn_t cur_mmap_size = mmap_size;
- mmap = grub_malloc (mmap_size);
+ mmap = grub_malloc (cur_mmap_size);
if (! mmap)
return 0;
- ret = grub_efi_get_memory_map (&mmap_size, mmap, 0, &desc_size, 0);
+ ret = grub_efi_get_memory_map (&cur_mmap_size, mmap, 0, &desc_size, 0);
grub_free (mmap);
if (ret < 0)
@@ -134,6 +135,8 @@ find_efi_mmap_size (void)
else if (ret > 0)
break;
+ if (mmap_size < cur_mmap_size)
+ mmap_size = cur_mmap_size;
mmap_size += (1 << 12);
}
--
1.8.1.4