Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8246557: test_os_linux.cpp uses NULL instead of MAP_FAILED to check f…
Browse files Browse the repository at this point in the history
…or failed mmap call

Reviewed-by: sjohanss, stefank
  • Loading branch information
Thomas Schatzl committed Jun 5, 2020
1 parent d071ed0 commit 0963050
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/hotspot/gtest/runtime/test_os_linux.cpp
Expand Up @@ -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);

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0963050

Please sign in to comment.