summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in2
-rw-r--r--src/extent_mmap.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index 5b809bf..8ba4a19 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -813,7 +813,7 @@ sa2u(size_t size, size_t alignment)
* Calculate the multi-page mapping that large_palloc() would need in
* order to guarantee the alignment.
*/
- if (usize + large_pad + PAGE_CEILING(alignment) < usize) {
+ if (usize + large_pad + PAGE_CEILING(alignment) - PAGE < usize) {
/* size_t overflow. */
return (0);
}
diff --git a/src/extent_mmap.c b/src/extent_mmap.c
index 0dd3247..23dd4f8 100644
--- a/src/extent_mmap.c
+++ b/src/extent_mmap.c
@@ -9,7 +9,7 @@ extent_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit)
void *ret;
size_t alloc_size;
- alloc_size = size + alignment;
+ alloc_size = size + alignment - PAGE;
/* Beware size_t wrap-around. */
if (alloc_size < size)
return (NULL);