Commit 13f9f031 authored by Max Kellermann's avatar Max Kellermann

util/HugeAllocator: fix division by zero due to inverted check

There were two ways this could fail: 1. division by zero when sysconf(_SC_PAGESIZE)==0 2. mmap() failure because the size parameter is not aligned to page size Neither ever happened: sysconf() never fails, and the only caller passes a size that is already aligned. Phew.
parent 1532ffe2
......@@ -46,7 +46,7 @@ static size_t
AlignToPageSize(size_t size)
{
static const long page_size = sysconf(_SC_PAGESIZE);
if (page_size > 0)
if (page_size == 0)
return size;
size_t ps(page_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment