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.
This commit is contained in:
parent
1532ffe215
commit
13f9f0315f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user