summaryrefslogtreecommitdiffstats
path: root/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-02-06 13:39:20 +0000
committerdim <dim@FreeBSD.org>2016-02-06 13:39:20 +0000
commit9c27ec33f2c82fe6c60c9c375a88f96a1e10a6a2 (patch)
tree4efb8604227ede935238eb1c67b626da1265d459 /contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h
parentaef1771e36f9842a113b9905d0d5926fe9d694aa (diff)
parent75958af7df18c2ae942829da1a8cf3b5bbcaeff6 (diff)
downloadFreeBSD-src-9c27ec33f2c82fe6c60c9c375a88f96a1e10a6a2.zip
FreeBSD-src-9c27ec33f2c82fe6c60c9c375a88f96a1e10a6a2.tar.gz
Merge compiler-rt release_38 branch r258968.
Note that there is still a problem on amd64, causing SIGBUS in the early startup of Address Sanitizer. This is being investigated.
Diffstat (limited to 'contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h')
-rw-r--r--contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h b/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h
index 326406b..8e5ce06 100644
--- a/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h
+++ b/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h
@@ -10,6 +10,7 @@
// A fast memory allocator that does not support free() nor realloc().
// All allocations are forever.
//===----------------------------------------------------------------------===//
+
#ifndef SANITIZER_PERSISTENT_ALLOCATOR_H
#define SANITIZER_PERSISTENT_ALLOCATOR_H
@@ -36,7 +37,7 @@ inline void *PersistentAllocator::tryAlloc(uptr size) {
for (;;) {
uptr cmp = atomic_load(&region_pos, memory_order_acquire);
uptr end = atomic_load(&region_end, memory_order_acquire);
- if (cmp == 0 || cmp + size > end) return 0;
+ if (cmp == 0 || cmp + size > end) return nullptr;
if (atomic_compare_exchange_weak(&region_pos, &cmp, cmp + size,
memory_order_acquire))
return (void *)cmp;
@@ -68,4 +69,4 @@ inline void *PersistentAlloc(uptr sz) {
} // namespace __sanitizer
-#endif // SANITIZER_PERSISTENT_ALLOCATOR_H
+#endif // SANITIZER_PERSISTENT_ALLOCATOR_H
OpenPOWER on IntegriCloud