From patchwork Tue Dec 14 13:07:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guzman Lugo, Fernando" X-Patchwork-Id: 409851 X-Patchwork-Delegate: hiroshi.doyu@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBED7epk015550 for ; Tue, 14 Dec 2010 13:07:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759261Ab0LNNGg (ORCPT ); Tue, 14 Dec 2010 08:06:36 -0500 Received: from na3sys009aog102.obsmtp.com ([74.125.149.69]:46584 "EHLO na3sys009aog102.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759259Ab0LNNGg (ORCPT ); Tue, 14 Dec 2010 08:06:36 -0500 Received: from source ([74.125.83.41]) by na3sys009aob102.postini.com ([74.125.148.12]) with SMTP ID DSNKTQdr22I1PFmfiPCa2l/RkQExZUzSKGbv@postini.com; Tue, 14 Dec 2010 05:06:36 PST Received: by mail-gw0-f41.google.com with SMTP id 22so373454gwj.0 for ; Tue, 14 Dec 2010 05:06:35 -0800 (PST) Received: by 10.150.202.12 with SMTP id z12mr8074391ybf.110.1292331995369; Tue, 14 Dec 2010 05:06:35 -0800 (PST) Received: from localhost.localdomain (cpe-66-25-41-139.tx.res.rr.com [66.25.41.139]) by mx.google.com with ESMTPS id r41sm71759yba.16.2010.12.14.05.06.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 14 Dec 2010 05:06:34 -0800 (PST) From: Fernando Guzman Lugo To: , , Cc: , , , , , "Guzman Lugo, Fernando" Subject: [PATCHv6 1/4] omap: iovmm - no gap checking for fixed address Date: Tue, 14 Dec 2010 07:07:24 -0600 Message-Id: <1292332047-8206-2-git-send-email-fernando.lugo@ti.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1292332047-8206-1-git-send-email-fernando.lugo@ti.com> References: <1292332047-8206-1-git-send-email-fernando.lugo@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 14 Dec 2010 13:07:41 +0000 (UTC) diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c index 8ce0de2..34f0012 100644 --- a/arch/arm/plat-omap/iovmm.c +++ b/arch/arm/plat-omap/iovmm.c @@ -289,10 +289,10 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, prev_end = 0; list_for_each_entry(tmp, &obj->mmap, list) { - if (prev_end >= start) + if (prev_end > start) break; - if (start + bytes < tmp->da_start) + if (start + bytes <= tmp->da_start) goto found; if (flags & IOVMF_DA_ANON) @@ -301,7 +301,7 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, prev_end = tmp->da_end; } - if ((start > prev_end) && (ULONG_MAX - start >= bytes)) + if ((start >= prev_end) && (ULONG_MAX - start + 1 >= bytes)) goto found; dev_dbg(obj->dev, "%s: no space to fit %08x(%x) flags: %08x\n",