Patchwork powerpc: fix pfn_valid() when memory starts at a non-zero address

login
register
mail settings
Submitter Scott Wood
Date Jan. 27, 2011, 8:31 p.m.
Message ID <20110127203137.GA30996@udp111988uds.am.freescale.net>
Download mbox | patch
Permalink /patch/80733/
State Accepted
Commit 81c386cc7f4c22b81ba94709d2d58754282ea05e
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Scott Wood - Jan. 27, 2011, 8:31 p.m.
max_mapnr is a pfn, not an index innto mem_map[].  So don't add
ARCH_PFN_OFFSET a second time.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/include/asm/page.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 53b64be..da4b200 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -101,7 +101,7 @@  extern phys_addr_t kernstart_addr;
 
 #ifdef CONFIG_FLATMEM
 #define ARCH_PFN_OFFSET		(MEMORY_START >> PAGE_SHIFT)
-#define pfn_valid(pfn)		((pfn) >= ARCH_PFN_OFFSET && (pfn) < (ARCH_PFN_OFFSET + max_mapnr))
+#define pfn_valid(pfn)		((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
 #endif
 
 #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)