public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* mempath prefault: fix off-by-one error
@ 2013-12-18 18:42 Marcelo Tosatti
  2013-12-20 17:59 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2013-12-18 18:42 UTC (permalink / raw)
  To: kvm-devel; +Cc: Paolo Bonzini, Andrea Arcangeli


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: mempath prefault: fix off-by-one error
  2013-12-18 18:42 mempath prefault: fix off-by-one error Marcelo Tosatti
@ 2013-12-20 17:59 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2013-12-20 17:59 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel, Andrea Arcangeli

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-20 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-18 18:42 mempath prefault: fix off-by-one error Marcelo Tosatti
2013-12-20 17:59 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox