From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCH 2/8] x86/xen: fix set_phys_range_identity() if pfn_e > MAX_P2M_PFN Date: Mon, 3 Feb 2014 17:01:31 +0000 Message-ID: <1391446897-21998-3-git-send-email-david.vrabel@citrix.com> References: <1391446897-21998-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1391446897-21998-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: x86@kernel.org, Ingo Molnar , David Vrabel , "H. Peter Anvin" , Boris Ostrovsky , Thomas Gleixner List-Id: xen-devel@lists.xenproject.org From: David Vrabel Allow set_phys_range_identity() to work with a range that overlaps MAX_P2M_PFN by clamping pfn_e to MAX_P2M_PFN. Signed-off-by: David Vrabel --- arch/x86/xen/p2m.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 437f13e..8969b7c 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -774,7 +774,7 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s, { unsigned long pfn; - if (unlikely(pfn_s >= MAX_P2M_PFN || pfn_e >= MAX_P2M_PFN)) + if (unlikely(pfn_s >= MAX_P2M_PFN)) return 0; if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) @@ -783,6 +783,9 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s, if (pfn_s > pfn_e) return 0; + if (pfn_e > MAX_P2M_PFN) + pfn_e = MAX_P2M_PFN; + for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1)); pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE)); pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) -- 1.7.2.5