@@ -494,12 +494,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
end = start + len;
real_end = HOST_PAGE_ALIGN(end);
- /*
- * Test if requested memory area fits target address space
- * It can fail only on 64-bit host with 32-bit target.
- * On any other target/host host mmap() handles this error correctly.
- */
- if ((unsigned long)start + len - 1 > (abi_ulong) -1) {
+ /* Test if requested memory area fits target address space. */
+ if (!guest_start_len_valid(start, len)) {
errno = EINVAL;
goto fail;
}
Signed-off-by: Richard Henderson <rth@twiddle.net> --- linux-user/mmap.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)