From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/9] allow intersecting region to be on the boundary. Date: Sat, 20 Sep 2008 11:32:48 -0700 Message-ID: <48D541D0.7090701@redhat.com> References: <1221840506-22996-1-git-send-email-glommer@redhat.com> <1221840506-22996-4-git-send-email-glommer@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, aliguori@us.ibm.com To: Glauber Costa Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56409 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbYITSdy (ORCPT ); Sat, 20 Sep 2008 14:33:54 -0400 In-Reply-To: <1221840506-22996-4-git-send-email-glommer@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Glauber Costa wrote: > Signed-off-by: Glauber Costa > --- > libkvm/libkvm.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c > index e768e44..fa65c30 100644 > --- a/libkvm/libkvm.c > +++ b/libkvm/libkvm.c > @@ -130,8 +130,8 @@ int get_intersecting_slot(unsigned long phys_addr) > int i; > > for (i = 0; i < KVM_MAX_NUM_MEM_REGIONS ; ++i) > - if (slots[i].len && slots[i].phys_addr < phys_addr && > - (slots[i].phys_addr + slots[i].len) > phys_addr) > + if (slots[i].len && slots[i].phys_addr <= phys_addr && > + (slots[i].phys_addr + slots[i].len) >= phys_addr) > return i; > return -1; > consider slots[i].phys_addr = 0 slots[i].len = 1 phys_addr = 1 with the new calculation, i (well, not me personally) will be considered an intersecting slot. Not that I (me this time) can understand how you can calculate interval intersection without the entire interval. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.