aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/module.c')
-rw-r--r--arch/x86/kernel/module.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 1c355c550960..52f256f2cc81 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -24,6 +24,7 @@
24#include <linux/bug.h> 24#include <linux/bug.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/gfp.h> 26#include <linux/gfp.h>
27#include <linux/jump_label.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/page.h> 30#include <asm/page.h>
@@ -37,20 +38,11 @@
37 38
38void *module_alloc(unsigned long size) 39void *module_alloc(unsigned long size)
39{ 40{
40 struct vm_struct *area; 41 if (PAGE_ALIGN(size) > MODULES_LEN)
41
42 if (!size)
43 return NULL;
44 size = PAGE_ALIGN(size);
45 if (size > MODULES_LEN)
46 return NULL;
47
48 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
49 if (!area)
50 return NULL; 42 return NULL;
51 43 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
52 return __vmalloc_area(area, GFP_KERNEL | __GFP_HIGHMEM, 44 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC,
53 PAGE_KERNEL_EXEC); 45 -1, __builtin_return_address(0));
54} 46}
55 47
56/* Free memory returned from module_alloc */ 48/* Free memory returned from module_alloc */
@@ -239,6 +231,9 @@ int module_finalize(const Elf_Ehdr *hdr,
239 apply_paravirt(pseg, pseg + para->sh_size); 231 apply_paravirt(pseg, pseg + para->sh_size);
240 } 232 }
241 233
234 /* make jump label nops */
235 jump_label_apply_nops(me);
236
242 return 0; 237 return 0;
243} 238}
244 239