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 12:11:16 -0500 |
commit | 86f6890e3689f2f75ecca8172eda0338fe3e9769 (patch) | |
tree | 4ac810292246016d67f02469479bc16c9b8c5796 | |
parent | ea01517247c9667b0728daadc5f687ef8fcf945e (diff) | |
download | haskell-86f6890e3689f2f75ecca8172eda0338fe3e9769.tar.gz |
rts/M32Alloc: Abort if m32 linker mmap fails
Previously we should just blinding dereference a NULL pointer.
-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; |