Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8246557: test_os_linux.cpp uses NULL instead of MAP_FAILED to check f…
…or failed mmap call

Reviewed-by: sjohanss, stefank
  • Loading branch information
Thomas Schatzl committed Jun 5, 2020
1 parent d071ed0 commit 09630505488f5b864472e776b6f7153e819ed8e5
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/hotspot/gtest/runtime/test_os_linux.cpp
@@ -159,7 +159,7 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_mixed_with_good_req_addr) {
char* const mapping = (char*) ::mmap(NULL, mapping_size,
PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-1, 0);
ASSERT_TRUE(mapping != NULL) << " mmap failed, mapping_size = " << mapping_size;
ASSERT_TRUE(mapping != MAP_FAILED) << " mmap failed, mapping_size = " << mapping_size;
// Unmap the mapping, it will serve as a value for a "good" req_addr
::munmap(mapping, mapping_size);

@@ -199,7 +199,7 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_mixed_with_bad_req_addr) {
char* const mapping = (char*) ::mmap(NULL, mapping_size,
PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-1, 0);
ASSERT_TRUE(mapping != NULL) << " mmap failed, mapping_size = " << mapping_size;
ASSERT_TRUE(mapping != MAP_FAILED) << " mmap failed, mapping_size = " << mapping_size;
// Leave the mapping intact, it will server as "bad" req_addr

class MappingHolder {

0 comments on commit 0963050

Please sign in to comment.