2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>

* loader/sparc64/ieee1275/linux.c (alloc_phys): Correct bounds checking.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-13 16:30:22 +01:00
parent 17cec782c4
commit 8c6052cea5
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* loader/sparc64/ieee1275/linux.c (alloc_phys): Correct bounds checking.
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* kern/sparc64/ieee1275/crt0.S (codestart): Move modules backwards.

View file

@ -193,20 +193,20 @@ alloc_phys (grub_addr_t size)
return 0;
addr = align_addr (addr, FOUR_MB);
if (addr >= end)
if (addr + size >= end)
return 0;
if (addr >= grub_phys_start && addr < grub_phys_end)
{
addr = align_addr (grub_phys_end, FOUR_MB);
if (addr >= end)
if (addr + size >= end)
return 0;
}
if ((addr + size) >= grub_phys_start
&& (addr + size) < grub_phys_end)
{
addr = align_addr (grub_phys_end, FOUR_MB);
if (addr >= end)
if (addr + size >= end)
return 0;
}
@ -217,14 +217,14 @@ alloc_phys (grub_addr_t size)
if (addr >= linux_paddr && addr < linux_end)
{
addr = linux_end;
if (addr >= end)
if (addr + size >= end)
return 0;
}
if ((addr + size) >= linux_paddr
&& (addr + size) < linux_end)
{
addr = linux_end;
if (addr >= end)
if (addr + size >= end)
return 0;
}
}