Skip to content
Snippets Groups Projects
Commit 580c1f91 authored by Raphael S.Carvalho's avatar Raphael S.Carvalho Committed by Pekka Enberg
Browse files

mmu: Fix off-by-one on range covered by ELF


The correct range is elf_start:(elf_start + elf_size - 1)

Signed-off-by: default avatarRaphael S.Carvalho <raphael.scarv@gmail.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent fbed5179
No related branches found
No related tags found
No related merge requests found
......@@ -192,7 +192,7 @@ void* phys_to_virt(phys pa)
{
// The ELF is mapped 1:1
void* phys_addr = reinterpret_cast<void*>(pa);
if ((phys_addr >= elf_start) && (phys_addr <= elf_start + elf_size)) {
if ((phys_addr >= elf_start) && (phys_addr < elf_start + elf_size)) {
return phys_addr;
}
......@@ -218,7 +218,7 @@ phys virt_to_phys_pt(void* virt)
phys virt_to_phys(void *virt)
{
// The ELF is mapped 1:1
if ((virt >= elf_start) && (virt <= elf_start + elf_size)) {
if ((virt >= elf_start) && (virt < elf_start + elf_size)) {
return reinterpret_cast<phys>(virt);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment