[PATCH] x86: make init_memory_mapping could handle small range

From: Yinghai Lu
Date: Tue Mar 03 2009 - 02:38:21 EST



Impact: fix small range ...

Ying Huang found init_memory_mapping has problem for small range less than 2M
when he tried to direct map for EFI runtime code out of max_low_pfn_mapped

it turns out we never consider that will be usedd for small range. and didn't
check the range...

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Reported-by: Ying Huang <ying.huang@xxxxxxxxx>

---
arch/x86/mm/init_64.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -748,6 +748,8 @@ unsigned long __init_refok init_memory_m
pos = start_pfn << PAGE_SHIFT;
end_pfn = ((pos + (PMD_SIZE - 1)) >> PMD_SHIFT)
<< (PMD_SHIFT - PAGE_SHIFT);
+ if (end_pfn > (end>>PAGE_SHIFT))
+ end_pfn = end>>PAGE_SHIFT;
if (start_pfn < end_pfn) {
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
pos = end_pfn << PAGE_SHIFT;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/