summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/BitMapMgr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dev/kernel/src/BitMapMgr.cc')
-rw-r--r--dev/kernel/src/BitMapMgr.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/dev/kernel/src/BitMapMgr.cc b/dev/kernel/src/BitMapMgr.cc
index 7f3f8500..51c4aed1 100644
--- a/dev/kernel/src/BitMapMgr.cc
+++ b/dev/kernel/src/BitMapMgr.cc
@@ -141,7 +141,15 @@ namespace Kernel
return (VoidPtr)ptr_bit_set;
}
- base = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base) + ((ptr_bit_set[kBitMapMagIdx] != kBitMapMagic) ? (size + pad) : ptr_bit_set[kBitMapSizeIdx]));
+ UIntPtr raw_base = reinterpret_cast<UIntPtr>(base);
+ UIntPtr offset = (ptr_bit_set[kBitMapMagIdx] != kBitMapMagic)
+ ? (size + pad)
+ : ptr_bit_set[kBitMapSizeIdx];
+
+ base = reinterpret_cast<VoidPtr>(raw_base + offset);
+
+ if (base == nullptr)
+ return nullptr;
}
return nullptr;