aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/include/asm/mmzone.h
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2013-05-28 16:35:54 -0400
committerHelge Deller <deller@gmx.de>2013-06-01 08:28:35 -0400
commitae249b5fa27f9fba25aa59664d4338efc2dd2394 (patch)
treecc045e18623c34e05ad2df2973e461dd40e4dc1c /arch/parisc/include/asm/mmzone.h
parent3f108de96ba449a8df3d7e3c053bf890fee2cb95 (diff)
parisc: fix kernel BUG at arch/parisc/include/asm/mmzone.h:50
With CONFIG_DISCONTIGMEM=y and multiple physical memory areas, cat /proc/kpageflags triggers this kernel bug: kernel BUG at arch/parisc/include/asm/mmzone.h:50! CPU: 2 PID: 7848 Comm: cat Tainted: G D W 3.10.0-rc3-64bit #44 IAOQ[0]: kpageflags_read0x128/0x238 IAOQ[1]: kpageflags_read0x12c/0x238 RP(r2): proc_reg_read0xbc/0x130 Backtrace: [<00000000402ca2d4>] proc_reg_read0xbc/0x130 [<0000000040235bcc>] vfs_read0xc4/0x1d0 [<0000000040235f0c>] SyS_read0x94/0xf0 [<0000000040105fc0>] syscall_exit0x0/0x14 kpageflags_read() walks through the whole memory, even if some memory areas are physically not available. So, we should better not BUG on an unavailable pfn in pfn_to_nid() but just return the expected value -1 or 0. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/include/asm/mmzone.h')
-rw-r--r--arch/parisc/include/asm/mmzone.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/parisc/include/asm/mmzone.h b/arch/parisc/include/asm/mmzone.h
index 0e625ab9aaec..cc50d33b7b88 100644
--- a/arch/parisc/include/asm/mmzone.h
+++ b/arch/parisc/include/asm/mmzone.h
@@ -39,17 +39,14 @@ extern unsigned char pfnnid_map[PFNNID_MAP_MAX];
39static inline int pfn_to_nid(unsigned long pfn) 39static inline int pfn_to_nid(unsigned long pfn)
40{ 40{
41 unsigned int i; 41 unsigned int i;
42 unsigned char r;
43 42
44 if (unlikely(pfn_is_io(pfn))) 43 if (unlikely(pfn_is_io(pfn)))
45 return 0; 44 return 0;
46 45
47 i = pfn >> PFNNID_SHIFT; 46 i = pfn >> PFNNID_SHIFT;
48 BUG_ON(i >= ARRAY_SIZE(pfnnid_map)); 47 BUG_ON(i >= ARRAY_SIZE(pfnnid_map));
49 r = pfnnid_map[i];
50 BUG_ON(r == 0xff);
51 48
52 return (int)r; 49 return (int)pfnnid_map[i];
53} 50}
54 51
55static inline int pfn_valid(int pfn) 52static inline int pfn_valid(int pfn)