From patchwork Mon Jul 9 09:03:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathyush X-Patchwork-Id: 9892 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5D1DE23E4F for ; Mon, 9 Jul 2012 08:50:51 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id D6EC5A1867F for ; Mon, 9 Jul 2012 08:50:50 +0000 (UTC) Received: by yhpp61 with SMTP id p61so11387178yhp.11 for ; Mon, 09 Jul 2012 01:50:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:date:message-id:x-mailer:x-brightmail-tracker:x-tm-as-mml :subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-gm-message-state; bh=HkgFZhli1DggnhwhozaDaT2BdAXNQP+10fCLeAxpXaU=; b=nIpp9skulKiAfke3yUNJPGmuLaBWiWcazfIJFmHvDkn02yVhkrclp0/RDiTFWq7KLC i4Zrb4D2Orc1YekW98giZzW9qEYOFoCAoJQb3a/rox2kKSP9PwPPXrW/aKbAk+STF3sN HVXJJDJH5yruqm0O6qek/kVPMZdRozD+7GgLehvdjwJbv/T141akB/+tnvow9aMg9qbr dBabkfdfB2kR572wowq5Jg4e46QA1D7UoK72lC9nlLPobgt/ABvhuDge7jvoOAtuly2y 4p4i1y9rKX78AfNXVv2P4zB36RZhmi1PYI7dp4b1UNG704f8Q/nY7NIAbJXMwyIvR0ep sWAw== Received: by 10.42.68.65 with SMTP id w1mr1433082ici.57.1341823850066; Mon, 09 Jul 2012 01:50:50 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp33045ibb; Mon, 9 Jul 2012 01:50:49 -0700 (PDT) Received: by 10.216.134.20 with SMTP id r20mr8302232wei.61.1341823848607; Mon, 09 Jul 2012 01:50:48 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id u8si24566939wia.35.2012.07.09.01.50.47; Mon, 09 Jul 2012 01:50:48 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1So9fz-00021J-B2; Mon, 09 Jul 2012 08:50:39 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1So9fb-0001qR-72 for linaro-mm-sig@lists.linaro.org; Mon, 09 Jul 2012 08:50:17 +0000 Received: from epcpsbgm1.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M6V00I77XV6F8U0@mailout3.samsung.com> for linaro-mm-sig@lists.linaro.org; Mon, 09 Jul 2012 17:50:11 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-3f-4ffa9b43d26a Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 99.7C.19326.34B9AFF4; Mon, 09 Jul 2012 17:50:11 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M6V00EFQXURP160@mmp2.samsung.com> for linaro-mm-sig@lists.linaro.org; Mon, 09 Jul 2012 17:50:11 +0900 (KST) From: Prathyush K To: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org Date: Mon, 09 Jul 2012 14:33:43 +0530 Message-id: <1341824623-7472-1-git-send-email-prathyush.k@samsung.com> X-Mailer: git-send-email 1.7.0.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNJMWRmVeSWpSXmKPExsVy+t9jQV3n2b/8Dda+5rX4cuUhkwOjx+1/ j5kDGKO4bFJSczLLUov07RK4MpY/u8lcsF60YtOLVWwNjE+Euhg5OSQETCSOzj7ODGGLSVy4 t56ti5GLQ0hgOqPEiYaFzBDOKiaJe20tbCBVbALaEr/m3GUFsUUE4iSOr7zFBGIzC8hIzL/b xg5iCwsESJxd+xishkVAVeLu8qMsIDavgJvEpicLobYpSLQuO8Q+gZF7ASPDKkbR1ILkguKk 9FxDveLE3OLSvHS95PzcTYxgLz6T2sG4ssHiEKMAB6MSD2/ntF/+QqyJZcWVuYcYJTiYlUR4 H3QChXhTEiurUovy44tKc1KLDzFKc7AoifMae3/1FxJITyxJzU5NLUgtgskycXBKNTCeSAg4 t3zarZeOM0+tvbtD/3zca8uwnXGq6smq3LcnnjfeURF6f8NL+dm5H97OrHR87bzTx/pb9fRn C82dqhc96768Kfz340/+iT//aaV45hvs7lOp035z8uSUlpzrRz/5c7/wvee8Ttu5SPR5SmxZ cd/58he1ClP98i1/HtAIuOpqcVxGoslFiaU4I9FQi7moOBEAbta6Gd4BAAA= X-TM-AS-MML: No Subject: [Linaro-mm-sig] [PATCH v2] ARM: dma-mapping: modify condition check while freeing pages X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQnkrFAQIF+LV2R0Shye4o3gDd6gCh6NPVZKNG8Qf754510N7PSJWAACcbIn8w2x88e7WhfH WARNING: at mm/vmalloc.c:1471 __iommu_free_buffer+0xcc/0xd0() Trying to vfree() nonexistent vm area (ef095000) Modules linked in: [] (unwind_backtrace+0x0/0xfc) from [] (warn_slowpath_common+0x54/0x64) [] (warn_slowpath_common+0x54/0x64) from [] (warn_slowpath_fmt+0x30/0x40) [] (warn_slowpath_fmt+0x30/0x40) from [] (__iommu_free_buffer+0xcc/0xd0) [] (__iommu_free_buffer+0xcc/0xd0) from [] (exynos_drm_free_buf+0xe4/0x138) [] (exynos_drm_free_buf+0xe4/0x138) from [] (exynos_drm_gem_destroy+0x80/0xfc) [] (exynos_drm_gem_destroy+0x80/0xfc) from [] (drm_gem_object_free+0x28/0x34) [] (drm_gem_object_free+0x28/0x34) from [] (drm_gem_object_release_handle+0xcc/0xd8) [] (drm_gem_object_release_handle+0xcc/0xd8) from [] (idr_for_each+0x74/0xb8) [] (idr_for_each+0x74/0xb8) from [] (drm_gem_release+0x1c/0x30) [] (drm_gem_release+0x1c/0x30) from [] (drm_release+0x608/0x694) [] (drm_release+0x608/0x694) from [] (fput+0xb8/0x228) [] (fput+0xb8/0x228) from [] (filp_close+0x64/0x84) [] (filp_close+0x64/0x84) from [] (put_files_struct+0xe8/0x104) [] (put_files_struct+0xe8/0x104) from [] (do_exit+0x608/0x774) [] (do_exit+0x608/0x774) from [] (do_group_exit+0x48/0xb4) [] (do_group_exit+0x48/0xb4) from [] (sys_exit_group+0x10/0x18) [] (sys_exit_group+0x10/0x18) from [] (ret_fast_syscall+0x0/0x30) This patch modifies the condition while freeing to match the condition used while allocation. This fixes the above warning which arises when array size is equal to PAGE_SIZE where allocation is done using kzalloc but free is done using vfree. Signed-off-by: Prathyush K --- arch/arm/mm/dma-mapping.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index dc560dc..0f9358b 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1091,7 +1091,7 @@ error: while (--i) if (pages[i]) __free_pages(pages[i], 0); - if (array_size < PAGE_SIZE) + if (array_size <= PAGE_SIZE) kfree(pages); else vfree(pages); @@ -1106,7 +1106,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages, size_t s for (i = 0; i < count; i++) if (pages[i]) __free_pages(pages[i], 0); - if (array_size < PAGE_SIZE) + if (array_size <= PAGE_SIZE) kfree(pages); else vfree(pages);