Skip to content

Commit 76e9f0e

Browse files
committed
phys_to_pfn_t: use phys_addr_t
A dma_addr_t is potentially smaller than a phys_addr_t on some archs. Don't truncate the address when doing the pfn conversion. Cc: Ross Zwisler <[email protected]> Reported-by: Matthew Wilcox <[email protected]> [willy: fix pfn_t_to_phys as well] Signed-off-by: Dan Williams <[email protected]>
1 parent 03fc2da commit 76e9f0e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

include/linux/pfn_t.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static inline pfn_t pfn_to_pfn_t(unsigned long pfn)
2929
return __pfn_to_pfn_t(pfn, 0);
3030
}
3131

32-
extern pfn_t phys_to_pfn_t(dma_addr_t addr, unsigned long flags);
32+
extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags);
3333

3434
static inline bool pfn_t_has_page(pfn_t pfn)
3535
{
@@ -48,7 +48,7 @@ static inline struct page *pfn_t_to_page(pfn_t pfn)
4848
return NULL;
4949
}
5050

51-
static inline dma_addr_t pfn_t_to_phys(pfn_t pfn)
51+
static inline phys_addr_t pfn_t_to_phys(pfn_t pfn)
5252
{
5353
return PFN_PHYS(pfn_t_to_pfn(pfn));
5454
}

kernel/memremap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void devm_memunmap(struct device *dev, void *addr)
150150
}
151151
EXPORT_SYMBOL(devm_memunmap);
152152

153-
pfn_t phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
153+
pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags)
154154
{
155155
return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags);
156156
}

tools/testing/nvdimm/test/iomap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res,
113113
}
114114
EXPORT_SYMBOL(__wrap_devm_memremap_pages);
115115

116-
pfn_t __wrap_phys_to_pfn_t(dma_addr_t addr, unsigned long flags)
116+
pfn_t __wrap_phys_to_pfn_t(phys_addr_t addr, unsigned long flags)
117117
{
118118
struct nfit_test_resource *nfit_res = get_nfit_res(addr);
119119

0 commit comments

Comments
 (0)