* grub-core/kern/mm.c (grub_mm_init_region): Skip regions less than
4K before the end. Reported by: Leif Lindholm
This commit is contained in:
parent
436ad5c3f4
commit
1bc783bd39
2 changed files with 15 additions and 0 deletions
|
@ -3,6 +3,12 @@
|
||||||
* docs/grub.texi (Networking commands): Add documentation for
|
* docs/grub.texi (Networking commands): Add documentation for
|
||||||
network related commands.
|
network related commands.
|
||||||
|
|
||||||
|
2013-09-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/mm.c (grub_mm_init_region): Skip regions less than
|
||||||
|
4K before the end.
|
||||||
|
Reported by: Leif Lindholm
|
||||||
|
|
||||||
2013-09-18 Pawel Wojtalczyk <eyak@wp.pl>
|
2013-09-18 Pawel Wojtalczyk <eyak@wp.pl>
|
||||||
2013-09-18 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-09-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,15 @@ grub_mm_init_region (void *addr, grub_size_t size)
|
||||||
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
|
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Exclude last 4K to avoid overflows. */
|
||||||
|
/* If addr + 0x1000 overflows then whole region is in excluded zone. */
|
||||||
|
if ((grub_addr_t) addr > ~((grub_addr_t) 0x1000))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If addr + 0x1000 + size overflows then decrease size. */
|
||||||
|
if (((grub_addr_t) addr + 0x1000) > ~(grub_addr_t) size)
|
||||||
|
size = ((grub_addr_t) -0x1000) - (grub_addr_t) addr;
|
||||||
|
|
||||||
for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p)
|
for (p = &grub_mm_base, q = *p; q; p = &(q->next), q = *p)
|
||||||
if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q)
|
if ((grub_uint8_t *) addr + size + q->pre_size == (grub_uint8_t *) q)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue