Index: lib/asan/asan_linux.cc =================================================================== --- lib/asan/asan_linux.cc +++ lib/asan/asan_linux.cc @@ -126,7 +126,7 @@ uptr map_size = shadow_size + left_padding + alignment; uptr map_start = (uptr)MmapNoAccess(map_size); - CHECK(map_start); + CHECK_NE(map_start, ~(uptr)0); uptr shadow_start = RoundUpTo(map_start + left_padding, alignment); UnmapFromTo(map_start, shadow_start - left_padding); Index: lib/asan/asan_premap_shadow.cc =================================================================== --- lib/asan/asan_premap_shadow.cc +++ lib/asan/asan_premap_shadow.cc @@ -40,7 +40,7 @@ uptr map_size = shadow_size + left_padding + alignment; uptr map_start = (uptr)MmapNoAccess(map_size); - CHECK(map_start); + CHECK_NE(map_start, ~(uptr)0); uptr shadow_start = RoundUpTo(map_start + left_padding, alignment); uptr shadow_end = shadow_start + shadow_size; Index: lib/hwasan/hwasan_dynamic_shadow.cc =================================================================== --- lib/hwasan/hwasan_dynamic_shadow.cc +++ lib/hwasan/hwasan_dynamic_shadow.cc @@ -46,7 +46,7 @@ const uptr map_size = shadow_size + left_padding + alignment; const uptr map_start = (uptr)MmapNoAccess(map_size); - CHECK(map_start); + CHECK_NE(map_start, ~(uptr)0); const uptr shadow_start = RoundUpTo(map_start + left_padding, alignment); Index: lib/sanitizer_common/sanitizer_allocator_primary64.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator_primary64.h +++ lib/sanitizer_common/sanitizer_allocator_primary64.h @@ -77,7 +77,7 @@ } else { NonConstSpaceBeg = address_range.Init(TotalSpaceSize, PrimaryAllocatorName); - CHECK(NonConstSpaceBeg); + CHECK_NE(NonConstSpaceBeg, ~(uptr)0); } SetReleaseToOSIntervalMs(release_to_os_interval_ms); MapWithCallbackOrDie(SpaceEnd(), AdditionalSize()); Index: lib/sanitizer_common/sanitizer_mac_libcdep.cc =================================================================== --- lib/sanitizer_common/sanitizer_mac_libcdep.cc +++ lib/sanitizer_common/sanitizer_mac_libcdep.cc @@ -15,12 +15,14 @@ #if SANITIZER_MAC #include "sanitizer_mac.h" +#include + namespace __sanitizer { void RestrictMemoryToMaxAddress(uptr max_address) { uptr size_to_mmap = GetMaxUserVirtualAddress() + 1 - max_address; void *res = MmapFixedNoAccess(max_address, size_to_mmap, "high gap"); - CHECK(res); + CHECK(res != MAP_FAILED); } } // namespace __sanitizer Index: lib/sanitizer_common/sanitizer_posix_libcdep.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -387,18 +387,13 @@ unsigned flags = MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE; if (fd == -1) flags |= MAP_ANON; - uptr p = internal_mmap((void *)fixed_addr, size, PROT_NONE, flags, fd, 0); - if (internal_iserror(p)) - return nullptr; - return (void *)p; + return (void *)internal_mmap((void *)fixed_addr, size, PROT_NONE, flags, fd, + 0); } void *MmapNoAccess(uptr size) { unsigned flags = MAP_PRIVATE | MAP_ANON | MAP_NORESERVE; - uptr p = internal_mmap(nullptr, size, PROT_NONE, flags, -1, 0); - if (internal_iserror(p)) - return nullptr; - return (void *)p; + return (void *)internal_mmap(nullptr, size, PROT_NONE, flags, -1, 0); } // This function is defined elsewhere if we intercepted pthread_attr_getstack. Index: lib/scudo/scudo_allocator_secondary.h =================================================================== --- lib/scudo/scudo_allocator_secondary.h +++ lib/scudo/scudo_allocator_secondary.h @@ -86,7 +86,7 @@ ReservedAddressRange AddressRange; uptr ReservedBeg = AddressRange.Init(ReservedSize, SecondaryAllocatorName); - if (UNLIKELY(!ReservedBeg)) + if (UNLIKELY(ReservedBeg == ~static_cast(0))) return nullptr; // A page-aligned pointer is assumed after that, so check it now. DCHECK(IsAligned(ReservedBeg, PageSize));