diff --git a/plugin_store/C2CarveoutDmaBufAllocator.cpp b/plugin_store/C2CarveoutDmaBufAllocator.cpp index 89b37cb58da97d3bd93c708cd6dd04bf04084395..b92baf912f9e2b82d85082f4c12eda2ac787e84f 100644 --- a/plugin_store/C2CarveoutDmaBufAllocator.cpp +++ b/plugin_store/C2CarveoutDmaBufAllocator.cpp @@ -171,6 +171,7 @@ class C2CarveoutDmaBufAllocation : public C2LinearAllocation { c2_status_t C2CarveoutDmaBufAllocation::map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence* fence, void** addr) { + static const size_t kPageSize = getpagesize(); (void)fence; // TODO: wait for fence *addr = nullptr; if (!mMappings.lock()->empty()) { @@ -193,7 +194,7 @@ c2_status_t C2CarveoutDmaBufAllocation::map(size_t offset, size_t size, C2Memory prot |= PROT_WRITE; } - size_t alignmentBytes = offset % PAGE_SIZE; + size_t alignmentBytes = offset % kPageSize; size_t mapOffset = offset - alignmentBytes; size_t mapSize = size + alignmentBytes; Mapping map = {nullptr, alignmentBytes, mapSize};