diff --git a/libc/bionic/mmap.cpp b/libc/bionic/mmap.cpp index 794f50ffa..9bc80a27e 100644 --- a/libc/bionic/mmap.cpp +++ b/libc/bionic/mmap.cpp @@ -48,7 +48,7 @@ void* mmap64(void* addr, size_t size, int prot, int flags, int fd, off64_t offse // prevent allocations large enough for `end - start` to overflow size_t rounded = BIONIC_ALIGN(size, PAGE_SIZE); - if (rounded < size || size > PTRDIFF_MAX) { + if (rounded < size || rounded > PTRDIFF_MAX) { errno = ENOMEM; return MAP_FAILED; }