[haiku-commits] haiku: hrev45313 - in src/system/boot: platform/bios_ia32 arch/arm platform/atari_m68k platform/amiga_m68k arch/m68k

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Feb 2013 16:38:02 +0100 (CET)

hrev45313 adds 1 changeset to branch 'master'
old head: 8dc3f98eda06039ae580319c454ddb982afce22e
new head: 32bd2dedd92c994efb538bec7fbc31f5dd5b6122
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=32bd2de+%5E8dc3f98

----------------------------------------------------------------------------

32bd2de: bootloader: Fix an overlooked condition in mmu_allocate()
  
  The size variable at this point is actually a page count.
  The test should never be true anyway though. Maybe we should use a
  pages variable for clarity?

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45313
Commit:      32bd2dedd92c994efb538bec7fbc31f5dd5b6122
URL:         http://cgit.haiku-os.org/haiku/commit/?id=32bd2de
Author:      François Revol <revol@xxxxxxx>
Date:        Thu Feb 21 15:35:37 2013 UTC

----------------------------------------------------------------------------

5 files changed, 10 insertions(+), 7 deletions(-)
src/system/boot/arch/arm/arch_mmu.cpp       | 4 ++--
src/system/boot/arch/m68k/mmu.cpp           | 3 ++-
src/system/boot/platform/amiga_m68k/mmu.cpp | 3 ++-
src/system/boot/platform/atari_m68k/mmu.cpp | 3 ++-
src/system/boot/platform/bios_ia32/mmu.cpp  | 4 ++--

----------------------------------------------------------------------------

diff --git a/src/system/boot/arch/arm/arch_mmu.cpp 
b/src/system/boot/arch/arm/arch_mmu.cpp
index 1183551..8867f7f 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 b7c2526..1a44790 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 03f56b9..1dde414 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 7132119..548d6d5 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 4eef5de..93eaed5 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++) {


Other related posts:

  • » [haiku-commits] haiku: hrev45313 - in src/system/boot: platform/bios_ia32 arch/arm platform/atari_m68k platform/amiga_m68k arch/m68k - revol