diff --git a/src/system/boot/arch/arm/arch_mmu.cpp b/src/system/boot/arch/arm/arch_mmu.cpp index 1183551384..8867f7f753 100644 --- a/src/system/boot/arch/arm/arch_mmu.cpp +++ b/src/system/boot/arch/arm/arch_mmu.cpp @@ -474,8 +474,8 @@ mmu_allocate(void *virtualAddress, size_t size) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_BASE - || address + size >= KERNEL_BASE + kMaxKernelSize) { + if (address < KERNEL_BASE || address + size * B_PAGE_SIZE + >= KERNEL_BASE + kMaxKernelSize) { TRACE(("mmu_allocate in illegal range\n address: %" B_PRIx32 " KERNELBASE: %" B_PRIx32 " KERNEL_BASE + kMaxKernelSize: %" B_PRIx32 " address + size : %" B_PRIx32 "\n", (uint32)address, diff --git a/src/system/boot/arch/m68k/mmu.cpp b/src/system/boot/arch/m68k/mmu.cpp index b7c2526d4a..1a447901d5 100644 --- a/src/system/boot/arch/m68k/mmu.cpp +++ b/src/system/boot/arch/m68k/mmu.cpp @@ -338,7 +338,8 @@ mmu_allocate(void *virtualAddress, size_t size) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_BASE || address + size >= KERNEL_BASE + kMaxKernelSize) + if (address < KERNEL_BASE || address + size * B_PAGE_SIZE + >= KERNEL_BASE + kMaxKernelSize) return NULL; for (uint32 i = 0; i < size; i++) { diff --git a/src/system/boot/platform/amiga_m68k/mmu.cpp b/src/system/boot/platform/amiga_m68k/mmu.cpp index 03f56b9f4e..1dde414257 100644 --- a/src/system/boot/platform/amiga_m68k/mmu.cpp +++ b/src/system/boot/platform/amiga_m68k/mmu.cpp @@ -338,7 +338,8 @@ mmu_allocate(void *virtualAddress, size_t size) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_BASE || address + size >= KERNEL_BASE + kMaxKernelSize) + if (address < KERNEL_BASE || address + size * B_PAGE_SIZE + >= KERNEL_BASE + kMaxKernelSize) return NULL; for (uint32 i = 0; i < size; i++) { diff --git a/src/system/boot/platform/atari_m68k/mmu.cpp b/src/system/boot/platform/atari_m68k/mmu.cpp index 7132119fd2..548d6d5c55 100644 --- a/src/system/boot/platform/atari_m68k/mmu.cpp +++ b/src/system/boot/platform/atari_m68k/mmu.cpp @@ -339,7 +339,8 @@ mmu_allocate(void *virtualAddress, size_t size) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_BASE || address + size >= KERNEL_BASE + kMaxKernelSize) + if (address < KERNEL_BASE || address + size * B_PAGE_SIZE + >= KERNEL_BASE + kMaxKernelSize) return NULL; for (uint32 i = 0; i < size; i++) { diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp index 4eef5defa5..93eaed5423 100644 --- a/src/system/boot/platform/bios_ia32/mmu.cpp +++ b/src/system/boot/platform/bios_ia32/mmu.cpp @@ -397,8 +397,8 @@ mmu_allocate(void *virtualAddress, size_t size) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_LOAD_BASE - || address + size >= KERNEL_LOAD_BASE + kMaxKernelSize) + if (address < KERNEL_LOAD_BASE || address + size * B_PAGE_SIZE + >= KERNEL_LOAD_BASE + kMaxKernelSize) return NULL; for (uint32 i = 0; i < size; i++) {