From: Atsushi Nemoto Date: Thu, 13 Jul 2006 14:01:50 +0000 (+0900) Subject: [MIPS] sparsemem: fix crash in show_mem X-Git-Tag: v2.6.18-rc2~81^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4dee85e2c6a7d7adf7ea4d6d3053a41c78175b7;p=linux-2.6 [MIPS] sparsemem: fix crash in show_mem With sparsemem, pfn should be checked by pfn_valid() before pfn_to_page(). Signed-off-by: Atsushi Nemoto Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c index 792c6eb442..c93aa6cbca 100644 --- a/arch/mips/mm/pgtable.c +++ b/arch/mips/mm/pgtable.c @@ -15,6 +15,8 @@ void show_mem(void) printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); pfn = max_mapnr; while (pfn-- > 0) { + if (!pfn_valid(pfn)) + continue; page = pfn_to_page(pfn); total++; if (PageHighMem(page))