diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-11-10 15:35:37 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-22 14:01:30 -0500 |
commit | c8b24dce7bba394ca60c8eba04c5bed7a7e9534e (patch) | |
tree | 85a2f5a1bb6e5c26dddc33acd1f99d7493d0784a | |
parent | 14ae4ab6d2ffc907ffe0a438acc51c614b72140e (diff) | |
download | haskell-c8b24dce7bba394ca60c8eba04c5bed7a7e9534e.tar.gz |
rts/M32Alloc: Abort if m32 linker mmap fails
Previously we should just blinding dereference a NULL pointer.
(cherry picked from commit 86f6890e3689f2f75ecca8172eda0338fe3e9769)
-rw-r--r-- | rts/linker/M32Alloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c index 6a2996d98f..52b182e54d 100644 --- a/rts/linker/M32Alloc.c +++ b/rts/linker/M32Alloc.c @@ -158,6 +158,9 @@ m32_allocator_init(void) // fragment the memory. size_t pgsz = getPageSize(); char* bigchunk = mmapForLinker(pgsz * M32_MAX_PAGES,MAP_ANONYMOUS,-1,0); + if (bigchunk == NULL) + barf("m32_allocator_init: Failed to map"); + int i; for (i=0; i<M32_MAX_PAGES; i++) { alloc.pages[i].base_addr = bigchunk + i*pgsz; |