Fix zero-length write(2).
authorRichard Henderson <rth@twiddle.net>
Mon, 29 Mar 2010 17:54:42 +0000 (10:54 -0700)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 6 May 2010 04:45:12 +0000 (06:45 +0200)
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
exec.c

diff --git a/exec.c b/exec.c
index 95b92f7..cddaf36 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -2429,6 +2429,9 @@ int page_check_range(target_ulong start, target_ulong len, int flags)
     assert(start < ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
 #endif
 
+    if (len == 0) {
+        return 0;
+    }
     if (start + len - 1 < start) {
         /* We've wrapped around.  */
         return -1;