From patchwork Tue Mar 30 18:53:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5/7] linux-user: Use guest_start_len_valid in mmap. Date: Tue, 30 Mar 2010 08:53:31 -0000 From: Richard Henderson X-Patchwork-Id: 49416 Message-Id: <6dc67394a20af270ba268a5471aef3c8275c1cdf.1270488612.git.rth@twiddle.net> To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com Signed-off-by: Richard Henderson --- linux-user/mmap.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 463679d..085030b 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -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; }