diff options
-rw-r--r-- | arch/x86/kernel/livepatch.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c index ff3c3101d003..d1d35ccffed3 100644 --- a/arch/x86/kernel/livepatch.c +++ b/arch/x86/kernel/livepatch.c | |||
@@ -42,7 +42,6 @@ int klp_write_module_reloc(struct module *mod, unsigned long type, | |||
42 | bool readonly; | 42 | bool readonly; |
43 | unsigned long val; | 43 | unsigned long val; |
44 | unsigned long core = (unsigned long)mod->module_core; | 44 | unsigned long core = (unsigned long)mod->module_core; |
45 | unsigned long core_ro_size = mod->core_ro_size; | ||
46 | unsigned long core_size = mod->core_size; | 45 | unsigned long core_size = mod->core_size; |
47 | 46 | ||
48 | switch (type) { | 47 | switch (type) { |
@@ -70,10 +69,12 @@ int klp_write_module_reloc(struct module *mod, unsigned long type, | |||
70 | /* loc does not point to any symbol inside the module */ | 69 | /* loc does not point to any symbol inside the module */ |
71 | return -EINVAL; | 70 | return -EINVAL; |
72 | 71 | ||
73 | if (loc < core + core_ro_size) | 72 | readonly = false; |
73 | |||
74 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | ||
75 | if (loc < core + mod->core_ro_size) | ||
74 | readonly = true; | 76 | readonly = true; |
75 | else | 77 | #endif |
76 | readonly = false; | ||
77 | 78 | ||
78 | /* determine if the relocation spans a page boundary */ | 79 | /* determine if the relocation spans a page boundary */ |
79 | numpages = ((loc & PAGE_MASK) == ((loc + size) & PAGE_MASK)) ? 1 : 2; | 80 | numpages = ((loc & PAGE_MASK) == ((loc + size) & PAGE_MASK)) ? 1 : 2; |