aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/os_utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-03-07 10:35:06 -0500
committerJack Lloyd <[email protected]>2019-03-07 10:35:06 -0500
commit9252df39094fc06106c340838411b1c753983199 (patch)
treef3ae224743bf2d28813a5565d232744a8380d0ca /src/lib/utils/os_utils.cpp
parent841c9cf1f30c6528a63ec238a585f0381627fece (diff)
Fix Coverity warnings
Checking a ptr against null after dereferencing it. Allowing exception throw to escape a noexcept function. Both harmless.
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r--src/lib/utils/os_utils.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index 71f4f12d4..aa599e4b0 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -383,14 +383,12 @@ std::vector<void*> OS::allocate_locked_pages(size_t count)
}
#endif
- if(ptr != nullptr)
- {
- // Make guard page following the data page
- page_prohibit_access(static_cast<uint8_t*>(ptr) + page_size);
+ std::memset(ptr, 0, 2*page_size); // zero both data and guard pages
- std::memset(ptr, 0, page_size);
- result.push_back(ptr);
- }
+ // Make guard page following the data page
+ page_prohibit_access(static_cast<uint8_t*>(ptr) + page_size);
+
+ result.push_back(ptr);
}
return result;