diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index 5847aac36..f2c1944c2 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -1386,8 +1386,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel, }; grub_addr_t min_addr2 = 0, max_addr2; - if (max_addr > ~size) - max_addr = ~size; + if (size && (max_addr > ~size)) + max_addr = ~size + 1; #ifdef GRUB_MACHINE_PCBIOS if (min_addr < 0x1000)