Commit c1502b7c authored by John S. Marvin's avatar John S. Marvin Committed by David Mosberger

yia64: Fix show_mem() panic

parent 28505ef9
......@@ -46,6 +46,8 @@ show_mem (void)
printk("Free swap: %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
i = max_mapnr;
while (i-- > 0) {
if (!pfn_valid(i))
continue;
total++;
if (PageReserved(mem_map+i))
reserved++;
......
......@@ -499,6 +499,8 @@ void show_mem(void)
for_each_pgdat(pgdat) {
printk("Node ID: %d\n", pgdat->node_id);
for(i = 0; i < pgdat->node_spanned_pages; i++) {
if (!ia64_pfn_valid(pgdat->node_start_pfn+i))
continue;
if (PageReserved(pgdat->node_mem_map+i))
reserved++;
else if (PageSwapCache(pgdat->node_mem_map+i))
......
......@@ -459,8 +459,11 @@ int
ia64_pfn_valid (unsigned long pfn)
{
char byte;
struct page *pg = pfn_to_page(pfn);
return __get_user(byte, (char *) pfn_to_page(pfn)) == 0;
return (__get_user(byte, (char *) pg) == 0)
&& ((((u64)pg & PAGE_MASK) == (((u64)(pg + 1) - 1) & PAGE_MASK))
|| (__get_user(byte, (char *) (pg + 1) - 1) == 0));
}
EXPORT_SYMBOL(ia64_pfn_valid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment