MemMap: Check for MAP_FAILED in mmap call.

This commit is contained in:
Unknown W. Brackets committed 2020-09-13 00:37:20 -07:00
1 parent 72df3fd339
commit 2b49c3e464
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -140,7 +140,7 @@ u8* MemArena::Find4GBBase() {
// address by grabbing 8GB and aligning the pointer.
const uint64_t EIGHT_GIGS = 0x200000000ULL;
void *base = mmap(0, EIGHT_GIGS, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
if (base) {
if (base && base != MAP_FAILED) {
INFO_LOG(SYSTEM, "base: %p", base);
uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL;
INFO_LOG(SYSTEM, "aligned_base: %p", (void *)aligned_base);