From patchwork Mon Mar 7 13:10:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jones X-Patchwork-Id: 615591 X-Patchwork-Delegate: tony@atomide.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 p27DAiLx007725 for ; Mon, 7 Mar 2011 13:10:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754511Ab1CGNKm (ORCPT ); Mon, 7 Mar 2011 08:10:42 -0500 Received: from mail1.matrix-vision.com ([78.47.19.71]:33106 "EHLO mail1.matrix-vision.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754415Ab1CGNKl (ORCPT ); Mon, 7 Mar 2011 08:10:41 -0500 Received: from mail1.matrix-vision.com (localhost [127.0.0.1]) by mail1.matrix-vision.com (Postfix) with ESMTP id 52D6172399; Mon, 7 Mar 2011 14:10:40 +0100 (CET) Received: from erinome (g2.matrix-vision.com [80.152.136.245]) by mail1.matrix-vision.com (Postfix) with ESMTPA id 17BC77221C; Mon, 7 Mar 2011 14:10:40 +0100 (CET) Received: from erinome (localhost [127.0.0.1]) by erinome (Postfix) with ESMTP id 725216F8A; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Received: by erinome (Postfix, from userid 108) id 639956F9C; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Received: from [192.168.65.46] (host65-46.intern.matrix-vision.de [192.168.65.46]) by erinome (Postfix) with ESMTPA id 4EE0B6F8A; Mon, 7 Mar 2011 14:10:39 +0100 (CET) Message-ID: <4D74D94F.7040702@matrix-vision.de> Date: Mon, 07 Mar 2011 14:10:39 +0100 From: Michael Jones User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: David Cohen CC: Hiroshi.DOYU@nokia.com, Laurent Pinchart , fernando.lugo@ti.com, Sakari Ailus , Linux Media Mailing List , linux-omap@vger.kernel.org Subject: [PATCH] omap: iommu: disallow mapping NULL address References: <4D6D219D.7020605@matrix-vision.de> <201103022018.23446.laurent.pinchart@ideasonboard.com> <4D6FBC7F.1080500@matrix-vision.de> <4D70F985.8030902@matrix-vision.de> In-Reply-To: X-MV-Disclaimer: true (erinome) X-AV-Checked: ClamAV using ClamSMTP (erinome) X-AV-Checked: ClamAV using ClamSMTP (mail1) 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Mar 2011 13:10:44 +0000 (UTC) diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index 5990ea6..dcb5513 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c @@ -850,7 +850,7 @@ int iommu_set_da_range(struct iommu *obj, u32 start, u32 end) if (end < start || !PAGE_ALIGN(start | end)) return -EINVAL; - obj->da_start = start; + obj->da_start = max(start, (u32)PAGE_SIZE); obj->da_end = end; return 0; @@ -950,7 +950,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) obj->name = pdata->name; obj->dev = &pdev->dev; obj->ctx = (void *)obj + sizeof(*obj); - obj->da_start = pdata->da_start; + + /* reserve the first page for NULL */ + obj->da_start = max(pdata->da_start, (u32)PAGE_SIZE); obj->da_end = pdata->da_end; mutex_init(&obj->iommu_lock);