linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch : arm : add a criteria for pfn_valid
@ 2019-08-17  3:00 Zhaoyang Huang
  2019-08-17  3:34 ` Matthew Wilcox
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhaoyang Huang @ 2019-08-17  3:00 UTC (permalink / raw)
  To: Andrew Morton, Zhaoyang Huang, Russell King, Mike Rapoport,
	Rob Herring, Florian Fainelli, Geert Uytterhoeven, Doug Berger,
	linux-mm, linux-kernel

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

pfn_valid can be wrong while the MSB of physical address be trimed as pfn
larger than the max_pfn.

Signed-off-by: Zhaoyang Huang <huangzhaoyang@gmail.com>
---
 arch/arm/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c2daabb..9c4d938 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -177,7 +177,8 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
 #ifdef CONFIG_HAVE_ARCH_PFN_VALID
 int pfn_valid(unsigned long pfn)
 {
-	return memblock_is_map_memory(__pfn_to_phys(pfn));
+	return (pfn > max_pfn) ?
+		false : memblock_is_map_memory(__pfn_to_phys(pfn));
 }
 EXPORT_SYMBOL(pfn_valid);
 #endif
-- 
1.9.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-18 10:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-17  3:00 [PATCH] arch : arm : add a criteria for pfn_valid Zhaoyang Huang
2019-08-17  3:34 ` Matthew Wilcox
2019-08-17  9:00 ` Mike Rapoport
2019-08-17  9:14   ` Zhaoyang Huang
2019-08-17 18:32 ` Russell King - ARM Linux admin
2019-08-18  7:46   ` Zhaoyang Huang
2019-08-18  8:20     ` Mike Rapoport
2019-08-18 10:15       ` Russell King - ARM Linux admin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox