!153 GetUxPageSize函数逻辑修复

Merge pull request !153 from 蔡一鸣/0521
This commit is contained in:
openharmony_ci 2024-05-21 07:53:00 +00:00 committed by Gitee
commit 62ac842d3e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -98,11 +98,11 @@ static size_t GetUxPageSize(uint64_t dataAddr, size_t dataSize)
HILOG_ERROR(LOG_CORE, "pageNoEnd < pageNoStart");
return 0;
}
if (pageNoEnd - pageNoStart > SIZE_MAX / PAGE_SIZE) {
HILOG_ERROR(LOG_CORE, "pageNoEnd - pageNoStart > SIZE_MAX / PAGE_SIZE");
if (pageNoEnd - pageNoStart + 1 > SIZE_MAX / PAGE_SIZE) {
HILOG_ERROR(LOG_CORE, "pageNoEnd - pageNoStart + 1 > SIZE_MAX / PAGE_SIZE");
return 0;
}
return (pageNoEnd - pageNoStart) * PAGE_SIZE;
return (pageNoEnd - pageNoStart + 1) * PAGE_SIZE;
}
static inline uint64_t RoundUp(uint64_t val, size_t align)