Patchwork [6/7] Fix zero-length write(2).

login
register
mail settings
Submitter Richard Henderson
Date March 29, 2010, 5:54 p.m.
Message ID <259b99693dc30d50fec822d4b3356c7082ad0c12.1270488612.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/49415/
State New
Headers show

Comments

Richard Henderson - March 29, 2010, 5:54 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 exec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Aurelien Jarno - May 6, 2010, 4:45 a.m.
On Mon, Mar 29, 2010 at 10:54:42AM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Thanks, applied.

> ---
>  exec.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index 33854e1..d69194c 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2461,6 +2461,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;
> -- 
> 1.6.6.1
> 
> 
> 
>

Patch

diff --git a/exec.c b/exec.c
index 33854e1..d69194c 100644
--- a/exec.c
+++ b/exec.c
@@ -2461,6 +2461,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;