SWDEV-357122 - fix failure in vdi so as to handle unreasonable input size in MallocManagedNegativeTest

Change-Id: I1ed1916b652afc67327b0935c3c60fc2a404df30
This commit is contained in:
Julia Jiang
2022-09-28 15:16:22 -04:00
committed by Julia Jiang
parent 05b2bd7995
commit dacd55f3d7
3 changed files with 11 additions and 0 deletions
+4
View File
@@ -201,6 +201,10 @@ static inline int memProtToOsProt(Os::MemProt prot) {
address Os::reserveMemory(address start, size_t size, size_t alignment, MemProt prot) {
size = alignUp(size, pageSize());
// check for invalid input size
if (size == 0) {
return NULL;
}
alignment = std::max(pageSize(), alignUp(alignment, pageSize()));
assert(isPowerOfTwo(alignment) && "not a power of 2");