[compiler-rt] aaf1149 - [scudo] Respect the return value of ReservedMemory::create() (NFC)
Chia-hung Duan via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 15:20:56 PDT 2023
Author: Chia-hung Duan
Date: 2023-07-31T22:20:19Z
New Revision: aaf11496a6c2b8d6e07b5044efe6b027359fb13c
URL: https://github.com/llvm/llvm-project/commit/aaf11496a6c2b8d6e07b5044efe6b027359fb13c
DIFF: https://github.com/llvm/llvm-project/commit/aaf11496a6c2b8d6e07b5044efe6b027359fb13c.diff
LOG: [scudo] Respect the return value of ReservedMemory::create() (NFC)
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D156586
Added:
Modified:
compiler-rt/lib/scudo/standalone/secondary.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index 5e76bc6432349a..4573f56f7ee6f0 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -570,14 +570,15 @@ void *MapAllocator<Config>::allocate(const Options &Options, uptr Size,
ReservedMemoryT ReservedMemory;
const uptr MapSize = RoundedSize + 2 * PageSize;
- ReservedMemory.create(/*Addr=*/0U, MapSize, nullptr, MAP_ALLOWNOMEM);
+ if (UNLIKELY(!ReservedMemory.create(/*Addr=*/0U, MapSize, nullptr,
+ MAP_ALLOWNOMEM))) {
+ return nullptr;
+ }
// Take the entire ownership of reserved region.
MemMapT MemMap = ReservedMemory.dispatch(ReservedMemory.getBase(),
ReservedMemory.getCapacity());
uptr MapBase = MemMap.getBase();
- if (UNLIKELY(!MapBase))
- return nullptr;
uptr CommitBase = MapBase + PageSize;
uptr MapEnd = MapBase + MapSize;
More information about the llvm-commits
mailing list