diff mbox

mempath prefault: fix off-by-one error

Message ID 20131218184217.GA26157@amt.cnet (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti Dec. 18, 2013, 6:42 p.m. UTC
Fix off-by-one error (noticed by Andrea Arcangeli).

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Paolo Bonzini Dec. 20, 2013, 5:59 p.m. UTC | #1
Il 18/12/2013 19:42, Marcelo Tosatti ha scritto:
> 
> Fix off-by-one error (noticed by Andrea Arcangeli).
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/exec.c b/exec.c
> index f4b9ef2..1be5252 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1000,7 +1000,7 @@ static void *file_ram_alloc(RAMBlock *block,
>          }
>  
>          /* MAP_POPULATE silently ignores failures */
> -        for (i = 0; i < (memory/hpagesize)-1; i++) {
> +        for (i = 0; i < (memory/hpagesize); i++) {
>              memset(area + (hpagesize*i), 0, 1);
>          }
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/exec.c b/exec.c
index f4b9ef2..1be5252 100644
--- a/exec.c
+++ b/exec.c
@@ -1000,7 +1000,7 @@  static void *file_ram_alloc(RAMBlock *block,
         }
 
         /* MAP_POPULATE silently ignores failures */
-        for (i = 0; i < (memory/hpagesize)-1; i++) {
+        for (i = 0; i < (memory/hpagesize); i++) {
             memset(area + (hpagesize*i), 0, 1);
         }