Commit c6f6b596 authored by Chris Metcalf's avatar Chris Metcalf Committed by Linus Torvalds

mm: make lowmem_page_address() use PFN_PHYS() for improved portability

This ensures that platforms with lowmem PAs above 32 bits work correctly
by avoiding truncating the PA during a left shift.
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4eaf3f64
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include <linux/mm_types.h> #include <linux/mm_types.h>
#include <linux/range.h> #include <linux/range.h>
#include <linux/pfn.h>
struct mempolicy; struct mempolicy;
struct anon_vma; struct anon_vma;
...@@ -595,7 +596,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone, ...@@ -595,7 +596,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
static __always_inline void *lowmem_page_address(struct page *page) static __always_inline void *lowmem_page_address(struct page *page)
{ {
return __va(page_to_pfn(page) << PAGE_SHIFT); return __va(PFN_PHYS(page_to_pfn(page)));
} }
#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
......
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