From patchwork Thu Jun 23 05:12:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9194467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD0DA6075F for ; Thu, 23 Jun 2016 05:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE02C2841A for ; Thu, 23 Jun 2016 05:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEBBE2842D; Thu, 23 Jun 2016 05:15:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E97B2841A for ; Thu, 23 Jun 2016 05:15:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFwwN-0000Yr-JU; Thu, 23 Jun 2016 05:12:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFwwL-0000Yl-RM for xen-devel@lists.xenproject.org; Thu, 23 Jun 2016 05:12:33 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 58/2E-07320-1CF6B675; Thu, 23 Jun 2016 05:12:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRWlGSWpSXmKPExsVyuP0Ov+6B/Ox wg9P3VCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozeL5vYC5ayV5y43crYwDiFrYuRk0NCwEji 7cR/TCC2kMBCRon9mzJBbDYBVYkN10+xgtgiAo4SOz7NBrOZBaokbl49wAxiCwu4S2xZPAUsz gJU339vO1icV8BO4vLLlSwQ8+Ukrs+czjSBkXMBI8MqRvXi1KKy1CJdU72kosz0jJLcxMwcXU MDU73c1OLixPTUnMSkYr3k/NxNjEBfMQDBDsYv/c6HGCU5mJREea0cssOF+JLyUyozEosz4ot Kc1KLDzHKcHAoSfD+yQLKCRalpqdWpGXmAIMGJi3BwaMkwjsbJM1bXJCYW5yZDpE6xajLseDH 7bVMQix5+XmpUuK8htlARQIgRRmleXAjYAF8iVFWSpiXEegoIZ6C1KLczBJU+VeM4hyMSsK87 0FW8WTmlcBtegV0BBPQEcv600GOKElESEk1MMrf7t/gNvWhw/IXqv9l7L9snHa0P7q89Ohxh5 8bCwQF7E31meo+Xn7Y/uFF3fI6vomLQo3qHLOKjvnK9t2w2+E6ZbnwrAdVjzduL1q0wzqR3/5 pu/6ZzDVS06KXMXzcphaTV1pisznjkk19oNQ7D4/lUnvX7b2RJu0csGsGZ7p5yHHvmJbYS0os xRmJhlrMRcWJAHL352hbAgAA X-Env-Sender: jgross@suse.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1466658752!34087047!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42880 invoked from network); 23 Jun 2016 05:12:32 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-11.tower-206.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 23 Jun 2016 05:12:32 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 67FFFAAAD; Thu, 23 Jun 2016 05:12:31 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Date: Thu, 23 Jun 2016 07:12:27 +0200 Message-Id: <1466658747-1623-1-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.6 Cc: Juergen Gross , boris.ostrovsky@oracle.com, torvalds@linux-foundation.org, david.vrabel@citrix.com Subject: [Xen-devel] [PATCH] xen: fix upper bound of pmd loop in xen_cleanhighmap() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP xen_cleanhighmap() is operating on level2_kernel_pgt only. The upper bound of the loop setting non-kernel-image entries to zero should not exceed the size of level2_kernel_pgt. Reported-by: Linus Torvalds Signed-off-by: Juergen Gross --- arch/x86/xen/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 478a2de..2693b7e 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -1113,7 +1113,7 @@ static void __init xen_cleanhighmap(unsigned long vaddr, /* NOTE: The loop is more greedy than the cleanup_highmap variant. * We include the PMD passed in on _both_ boundaries. */ - for (; vaddr <= vaddr_end && (pmd < (level2_kernel_pgt + PAGE_SIZE)); + for (; vaddr <= vaddr_end && (pmd < (level2_kernel_pgt + PTRS_PER_PMD)); pmd++, vaddr += PMD_SIZE) { if (pmd_none(*pmd)) continue;