From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: mempath prefault: fix off-by-one error Date: Fri, 20 Dec 2013 18:59:02 +0100 Message-ID: <52B48566.9070307@redhat.com> References: <20131218184217.GA26157@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm-devel , Andrea Arcangeli To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:15459 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938Ab3LTR7G (ORCPT ); Fri, 20 Dec 2013 12:59:06 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBKHx6x4031112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Dec 2013 12:59:06 -0500 In-Reply-To: <20131218184217.GA26157@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Il 18/12/2013 19:42, Marcelo Tosatti ha scritto: > > Fix off-by-one error (noticed by Andrea Arcangeli). > > Signed-off-by: Marcelo Tosatti > > 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