From 9205ac07e3a1a8c4214298f4a6507c6a5a8f549d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 14 Jan 2010 22:06:26 +0100 Subject: [PATCH] Fix off-by-one error --- lib/relocator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/relocator.c b/lib/relocator.c index b7fe404c3..3e93abbaa 100644 --- a/lib/relocator.c +++ b/lib/relocator.c @@ -161,7 +161,7 @@ get_best_header (struct grub_relocator *rel, { grub_addr_t allowable_start, allowable_end; allowable_start = (grub_addr_t) h; - allowable_end = (grub_addr_t) (h + 1 + h->size); + allowable_end = (grub_addr_t) (h + h->size); try_addr (allowable_start, allowable_end); @@ -308,7 +308,7 @@ malloc_in_range (struct grub_relocator *rel, if (best_addr - (grub_addr_t) hb >= sizeof (*hb)) { - hb->size = ((best_addr - (grub_addr_t) hb) >> GRUB_MM_ALIGN_LOG2) - 1; + hb->size = ((best_addr - (grub_addr_t) hb) >> GRUB_MM_ALIGN_LOG2); if (foll) { foll->next = hb;