Patchwork [4/4] fix 0 sized write syscall

login
register
mail settings
Submitter Riku Voipio
Date March 26, 2010, 3:25 p.m.
Message ID <52e932ccb17304f60def454d2154726c972bacb6.1269616764.git.riku.voipio@nokia.com>
Download mbox | patch
Permalink /patch/48654/
State New
Headers show

Comments

Riku Voipio - March 26, 2010, 3:25 p.m.
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(-)
Richard Henderson - March 26, 2010, 4:07 p.m.
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~

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