From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [PATCH] kvm: coalesced_mmio: remove one redundant check inside of coalesced_mmio_in_range() Date: Fri, 12 Dec 2014 09:02:06 +0800 Message-ID: <548A3E8E.7080609@intel.com> References: <1418266961-27277-1-git-send-email-tiejun.chen@intel.com> <54897FFD.5030806@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mga11.intel.com ([192.55.52.93]:52514 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757702AbaLLBCK (ORCPT ); Thu, 11 Dec 2014 20:02:10 -0500 In-Reply-To: <54897FFD.5030806@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2014/12/11 19:29, Paolo Bonzini wrote: > > > On 11/12/2014 04:02, Tiejun Chen wrote: >> We already check 'len' above to make sure it already isn't >> negative here, so indeed, (addr + len < addr) should never be happened. > > ... except if there is an overflow. Sorry, I'm confused. 'addr' is u64 and now 'len' would always be '>=0', what's your a so-called overflow here? And we also have such a check below, (addr + len > dev->zone.addr + dev->zone.size), so can this guarantee an overflow? Thanks Tiejun > > Paolo > >> Signed-off-by: Tiejun Chen >> --- >> virt/kvm/coalesced_mmio.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c >> index 00d8642..60f59cd 100644 >> --- a/virt/kvm/coalesced_mmio.c >> +++ b/virt/kvm/coalesced_mmio.c >> @@ -30,8 +30,6 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev, >> */ >> if (len < 0) >> return 0; >> - if (addr + len < addr) >> - return 0; >> if (addr < dev->zone.addr) >> return 0; >> if (addr + len > dev->zone.addr + dev->zone.size) >> > -- > 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 >