From patchwork Wed May 14 06:03:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 30145 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B13220446 for ; Wed, 14 May 2014 06:14:12 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id va2sf6658780obc.5 for ; Tue, 13 May 2014 23:14:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :mime-version:cc:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=z344owsFdVj6SqYbNktAhhC6oJ12T9F9WCpzJ7gDUpM=; b=KCbYd98YAmVQtTtDoeZrv2S4FY3z52Vf1vFOwrfpdlVJqPRbgh8epi3NHfvXia6+YW nURDSaKWsPYVgfgnYWGuS7Pb/aXnZHbWv5NKCg9cpledwwBOniCFaDsgW6mWTAWzT3LV GpQD8clla1GcORV1hi7snmZxmME4IkGZsNmi9xcJDTYy8oP/iT1gklQkdPceIUxIHTAM Fgj7bWTfzshW72tqNlH/lBbYUne9O86/IOWTzVFzty2E/Cs95Zh5865ztFxg4nosVja7 DMVCKiOqCLhhvWXtv2XvqJ2Z/POjiKYJXTwON/Zlod+lIJQBc2Lf66PT4Nau96nm7yDN 5/Iw== X-Gm-Message-State: ALoCoQllrOWJa2XcqKVHQIkmJz2m2qhBa5lG8ycMu27CKWFpvP78fGLpi9RcvCn146OC79nck0zl X-Received: by 10.182.227.131 with SMTP id sa3mr790018obc.38.1400048052209; Tue, 13 May 2014 23:14:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.46 with SMTP id k43ls1581542qgk.58.gmail; Tue, 13 May 2014 23:14:12 -0700 (PDT) X-Received: by 10.52.255.98 with SMTP id ap2mr1148472vdd.3.1400048052135; Tue, 13 May 2014 23:14:12 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id w10si160439vei.16.2014.05.13.23.14.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 23:14:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db11so1779498veb.36 for ; Tue, 13 May 2014 23:14:12 -0700 (PDT) X-Received: by 10.220.10.2 with SMTP id n2mr1419999vcn.26.1400048052054; Tue, 13 May 2014 23:14:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp208920vcb; Tue, 13 May 2014 23:14:11 -0700 (PDT) X-Received: by 10.140.33.181 with SMTP id j50mr2578756qgj.81.1400048051599; Tue, 13 May 2014 23:14:11 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id t6si347090qat.49.2014.05.13.23.14.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2014 23:14:11 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkSQa-0002BE-Te; Wed, 14 May 2014 06:12:32 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkSQT-0001vM-T8 for linux-arm-kernel@lists.infradead.org; Wed, 14 May 2014 06:12:30 +0000 Received: from 172.24.2.119 (EHLO szxeml212-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AOQ34775; Wed, 14 May 2014 14:10:51 +0800 (CST) Received: from SZXEML455-HUB.china.huawei.com (10.82.67.198) by szxeml212-edg.china.huawei.com (172.24.2.181) with Microsoft SMTP Server (TLS) id 14.3.158.1; Wed, 14 May 2014 14:10:47 +0800 Received: from LGGEML406-HUB.china.huawei.com (10.72.61.84) by SZXEML455-HUB.china.huawei.com (10.82.67.198) with Microsoft SMTP Server (TLS) id 14.3.158.1; Wed, 14 May 2014 14:10:48 +0800 Received: from kernel-host.huawei (10.107.197.247) by lggeml406-hub.china.huawei.com (10.72.61.84) with Microsoft SMTP Server id 14.3.158.1; Wed, 14 May 2014 14:10:42 +0800 From: Wang Nan To: Russell King Subject: [PATCH] arm: mm: fix lowmem virtual address range check Date: Wed, 14 May 2014 14:03:59 +0800 Message-ID: <1400047439-23961-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140513_231226_250405_288F74CD X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.4 (-) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [119.145.14.66 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Wang Nan , Will Deacon , Geng Hui , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patch makes sure the argument of __phys_to_virt is a valid physical address when clear lowmem memory maps. The last few lines prepare_page_table() clear page mapping in the gap between largest low physical memory and the upper bound of lowmem. It uses __phys_to_virt(end) to calculate virtual address from where the clearing start. However, if the platform uses private nonliner __phys_to_virt(), 'end' may goes into another mapping region. This patch uses __phys_to_virt(end - 1) + 1 for insurance purposes. Signed-off-by: Wang Nan Cc: Geng Hui Cc: Will Deacon --- arch/arm/mm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b68c6b2..87340ee 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1217,7 +1217,7 @@ static inline void prepare_page_table(void) * Clear out all the kernel space mappings, except for the first * memory bank, up to the vmalloc region. */ - for (addr = __phys_to_virt(end); + for (addr = __phys_to_virt(end - 1) + 1; addr < VMALLOC_START; addr += PMD_SIZE) pmd_clear(pmd_off_k(addr)); }