011fe81
From 5d1749ea5730be5c9c32228461b784317a500f4b Mon Sep 17 00:00:00 2001
011fe81
From: Vladimir Serbinenko <phcoder@gmail.com>
011fe81
Date: Wed, 26 Mar 2014 08:48:30 +0100
58fe9aa
Subject: [PATCH 068/152] 	* grub-core/lib/relocator.c: Fix the case when
011fe81
 end of leftover is used.
011fe81
011fe81
---
011fe81
 ChangeLog                 | 4 ++++
011fe81
 grub-core/lib/relocator.c | 2 ++
011fe81
 2 files changed, 6 insertions(+)
011fe81
011fe81
diff --git a/ChangeLog b/ChangeLog
011fe81
index 091535b..9404eda 100644
011fe81
--- a/ChangeLog
011fe81
+++ b/ChangeLog
011fe81
@@ -1,3 +1,7 @@
011fe81
+2014-03-26  Vladimir Serbinenko  <phcoder@gmail.com>
011fe81
+
011fe81
+	* grub-core/lib/relocator.c: Fix the case when end of leftover is used.
011fe81
+
011fe81
 2014-03-26  Fu Wei <fu.wei@linaro.org>
011fe81
 
011fe81
 	* grub-core/loader/arm64/linux.c: Remove redundant "0x".
011fe81
diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
011fe81
index 9f9770b..cb11ea5 100644
011fe81
--- a/grub-core/lib/relocator.c
011fe81
+++ b/grub-core/lib/relocator.c
011fe81
@@ -865,6 +865,8 @@ malloc_in_range (struct grub_relocator *rel,
011fe81
 			% GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT;
011fe81
 		      struct grub_relocator_fw_leftover *lo
011fe81
 			= events[last_lo].leftover;
011fe81
+		      if (offend == 0 && alloc_end != alloc_start)
011fe81
+			offend = GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT;
011fe81
 		      lo->freebytes[offstart / 8]
011fe81
 			&= ((1 << (8 - (start % 8))) - 1);
011fe81
 		      grub_memset (lo->freebytes + (offstart + 7) / 8, 0,
011fe81
-- 
37b39b7
1.9.3
011fe81