Patchwork [5/7] linux-user: Use guest_start_len_valid in mmap.

login
register
mail settings
Submitter Richard Henderson
Date March 30, 2010, 6:53 p.m.
Message ID <6dc67394a20af270ba268a5471aef3c8275c1cdf.1270488612.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/49416/
State New
Headers show

Comments

Richard Henderson - March 30, 2010, 6:53 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/mmap.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

Patch

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;
         }