From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934219AbcKJPmH (ORCPT ); Thu, 10 Nov 2016 10:42:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52904 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933396AbcKJPmG (ORCPT ); Thu, 10 Nov 2016 10:42:06 -0500 Subject: Re: [RFC v2 2/8] iommu/iova: fix __alloc_and_insert_iova_range To: Joerg Roedel References: <1478258646-3117-1-git-send-email-eric.auger@redhat.com> <1478258646-3117-3-git-send-email-eric.auger@redhat.com> <20161110152241.GF2078@8bytes.org> Cc: drjones@redhat.com, jason@lakedaemon.net, kvm@vger.kernel.org, marc.zyngier@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, diana.craciun@nxp.com, alex.williamson@redhat.com, pranav.sawargaonkar@gmail.com, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, robin.murphy@arm.com, christoffer.dall@linaro.org, eric.auger.pro@gmail.com From: Auger Eric Message-ID: Date: Thu, 10 Nov 2016 16:41:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161110152241.GF2078@8bytes.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 10 Nov 2016 15:42:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joerg, On 10/11/2016 16:22, Joerg Roedel wrote: > On Fri, Nov 04, 2016 at 11:24:00AM +0000, Eric Auger wrote: >> Fix the size check within start_pfn and limit_pfn. >> >> Signed-off-by: Eric Auger >> >> --- >> >> the issue was observed when playing with 1 page iova domain with >> higher iova reserved. >> --- >> drivers/iommu/iova.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c >> index e23001b..ee29dbf 100644 >> --- a/drivers/iommu/iova.c >> +++ b/drivers/iommu/iova.c >> @@ -147,7 +147,7 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad, >> if (!curr) { >> if (size_aligned) >> pad_size = iova_get_pad_size(size, limit_pfn); >> - if ((iovad->start_pfn + size + pad_size) > limit_pfn) { >> + if ((iovad->start_pfn + size + pad_size - 1) > limit_pfn) { > > A >= check is more readable here. Sure Thanks Eric > > > Joerg > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >