aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/p2m.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2014-01-06 06:55:13 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2014-05-15 11:13:23 -0400
commita9b5bff66b2a63f7d0f42434f5da9024b442159c (patch)
treecbb48a2c20b256abb44fbe157b98c2981dffa546 /arch/x86/xen/p2m.c
parentfcca2e3119f3771dcfd0b03b3718b3c51b5f21c3 (diff)
x86/xen: fix set_phys_range_identity() if pfn_e > MAX_P2M_PFN
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 <david.vrabel@citrix.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen/p2m.c')
-rw-r--r--arch/x86/xen/p2m.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 4fc71cc1705b..82c8c9305510 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,
774{ 774{
775 unsigned long pfn; 775 unsigned long pfn;
776 776
777 if (unlikely(pfn_s >= MAX_P2M_PFN || pfn_e >= MAX_P2M_PFN)) 777 if (unlikely(pfn_s >= MAX_P2M_PFN))
778 return 0; 778 return 0;
779 779
780 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) 780 if (unlikely(xen_feature(XENFEAT_auto_translated_physmap)))
@@ -783,6 +783,9 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
783 if (pfn_s > pfn_e) 783 if (pfn_s > pfn_e)
784 return 0; 784 return 0;
785 785
786 if (pfn_e > MAX_P2M_PFN)
787 pfn_e = MAX_P2M_PFN;
788
786 for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1)); 789 for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1));
787 pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE)); 790 pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE));
788 pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) 791 pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE)