* grub-core/kern/mm.c (grub_mm_init_region): Fix condition for

	detecting too small regions.
parent ec2dd179
2013-04-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mm.c (grub_mm_init_region): Fix condition for
detecting too small regions.
2013-04-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.core.def (legacycfg): Enable on EFI.
......@@ -140,12 +140,13 @@ grub_mm_init_region (void *addr, grub_size_t size)
/* Allocate a region from the head. */
r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN);
size -= (char *) r - (char *) addr + sizeof (*r);
/* If this region is too small, ignore it. */
if (size < GRUB_MM_ALIGN)
if (size < GRUB_MM_ALIGN + (char *) r - (char *) addr + sizeof (*r))
return;
size -= (char *) r - (char *) addr + sizeof (*r);
h = (grub_mm_header_t) (r + 1);
h->next = h;
h->magic = GRUB_MM_FREE_MAGIC;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment