aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 712ae47af0bf..65ae576030da 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -17,7 +17,6 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/debugobjects.h> 19#include <linux/debugobjects.h>
20#include <linux/vmalloc.h>
21#include <linux/kallsyms.h> 20#include <linux/kallsyms.h>
22#include <linux/list.h> 21#include <linux/list.h>
23#include <linux/rbtree.h> 22#include <linux/rbtree.h>
@@ -175,6 +174,21 @@ static int vmap_page_range(unsigned long addr, unsigned long end,
175 return nr; 174 return nr;
176} 175}
177 176
177static inline int is_vmalloc_or_module_addr(const void *x)
178{
179 /*
180 * x86-64 and sparc64 put modules in a special place,
181 * and fall back on vmalloc() if that fails. Others
182 * just put it in the vmalloc space.
183 */
184#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
185 unsigned long addr = (unsigned long)x;
186 if (addr >= MODULES_VADDR && addr < MODULES_END)
187 return 1;
188#endif
189 return is_vmalloc_addr(x);
190}
191
178/* 192/*
179 * Walk a vmap address to the struct page it maps. 193 * Walk a vmap address to the struct page it maps.
180 */ 194 */
@@ -188,8 +202,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
188 * XXX we might need to change this if we add VIRTUAL_BUG_ON for 202 * XXX we might need to change this if we add VIRTUAL_BUG_ON for
189 * architectures that do not vmalloc module space 203 * architectures that do not vmalloc module space
190 */ 204 */
191 VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) && 205 VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr));
192 !is_module_address(addr));
193 206
194 if (!pgd_none(*pgd)) { 207 if (!pgd_none(*pgd)) {
195 pud_t *pud = pud_offset(pgd, addr); 208 pud_t *pud = pud_offset(pgd, addr);