From 4a04699258764201f3f5dffbd974740c4e4e5603 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 14 Jan 2010 19:14:04 +0100 Subject: [PATCH] Fix a mistake with size calculation --- lib/relocator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/relocator.c b/lib/relocator.c index 090a6c7e3..b7fe404c3 100644 --- a/lib/relocator.c +++ b/lib/relocator.c @@ -308,12 +308,12 @@ 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; + hb->size = ((best_addr - (grub_addr_t) hb) >> GRUB_MM_ALIGN_LOG2) - 1; if (foll) { foll->next = hb; hbp->next = foll; - if (rb->first == hbp) + if (rb->first == hb) rb->first = foll; } }