Skip to content

Commit

Permalink
mm: make lowmem_page_address() use PFN_PHYS() for improved portability
Browse files Browse the repository at this point in the history
This ensures that platforms with lowmem PAs above 32 bits work correctly
by avoiding truncating the PA during a left shift.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: Barry Song <21cnbao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Chris Metcalf authored and Linus Torvalds committed May 25, 2010
1 parent 4eaf3f6 commit c6f6b59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
#include <linux/range.h>
#include <linux/pfn.h>

struct mempolicy;
struct anon_vma;
Expand Down Expand Up @@ -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)
{
return __va(page_to_pfn(page) << PAGE_SHIFT);
return __va(PFN_PHYS(page_to_pfn(page)));
}

#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
Expand Down

0 comments on commit c6f6b59

Please sign in to comment.