diff mbox

[4/4] fix 0 sized write syscall

Message ID 52e932ccb17304f60def454d2154726c972bacb6.1269616764.git.riku.voipio@nokia.com
State New
Headers show

Commit Message

Riku Voipio March 26, 2010, 3:25 p.m. UTC
From: Riku Voipio <riku.voipio@nokia.com>

fixes running ldconfig under qemu linux-user

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: martin.mohring@opensuse.org
---
 exec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Richard Henderson March 26, 2010, 4:07 p.m. UTC | #1
On 03/26/2010 08:25 AM, Riku Voipio wrote:
> +    if (len == 0) {
> +        return 0;
> +    }

This part is ok.

>  
> -    if (start + len - 1 < start) {
> +    if (start + len < start) {

This part re-introduces the bug I fixed.

  start = 0xffffff00
  len = 256

should succeed, and it won't reverting the (len-1) change.


r~
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 14767b7..c834be2 100644
--- a/exec.c
+++ b/exec.c
@@ -2409,8 +2409,11 @@  int page_check_range(target_ulong start, target_ulong len, int flags)
 #if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
     assert(start < ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
 #endif
+    if (len == 0) {
+        return 0;
+    }
 
-    if (start + len - 1 < start) {
+    if (start + len < start) {
         /* We've wrapped around.  */
         return -1;
     }