X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=mm%2Fsparse.c;h=98d6b39c34722c1734bee587a612ce0f74d7fbfa;hb=319d1e240683d37924ea8977c91730c3393fd453;hp=f6a43c09c322cdb39077392ec1c77e9904c52d82;hpb=6e5565f949af1322f8f3d3f43d044645ae448499;p=mv-sheeva.git diff --git a/mm/sparse.c b/mm/sparse.c index f6a43c09c32..98d6b39c347 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -149,8 +149,18 @@ static inline int sparse_early_nid(struct mem_section *section) /* Record a memory area against a node. */ void __init memory_present(int nid, unsigned long start, unsigned long end) { + unsigned long max_arch_pfn = 1UL << (MAX_PHYSMEM_BITS-PAGE_SHIFT); unsigned long pfn; + /* + * Sanity checks - do not allow an architecture to pass + * in larger pfns than the maximum scope of sparsemem: + */ + if (start >= max_arch_pfn) + return; + if (end >= max_arch_pfn) + end = max_arch_pfn; + start &= PAGE_SECTION_MASK; for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { unsigned long section = pfn_to_section_nr(pfn);