aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/kernel/module.c b/kernel/module.c
index a389b423c279..7734595bd329 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -105,7 +105,7 @@ void __module_put_and_exit(struct module *mod, long code)
105 do_exit(code); 105 do_exit(code);
106} 106}
107EXPORT_SYMBOL(__module_put_and_exit); 107EXPORT_SYMBOL(__module_put_and_exit);
108 108
109/* Find a module section: 0 means not found. */ 109/* Find a module section: 0 means not found. */
110static unsigned int find_sec(Elf_Ehdr *hdr, 110static unsigned int find_sec(Elf_Ehdr *hdr,
111 Elf_Shdr *sechdrs, 111 Elf_Shdr *sechdrs,
@@ -179,7 +179,7 @@ static unsigned long __find_symbol(const char *name,
179 struct module *mod; 179 struct module *mod;
180 const struct kernel_symbol *ks; 180 const struct kernel_symbol *ks;
181 181
182 /* Core kernel first. */ 182 /* Core kernel first. */
183 *owner = NULL; 183 *owner = NULL;
184 ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab); 184 ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
185 if (ks) { 185 if (ks) {
@@ -231,7 +231,7 @@ static unsigned long __find_symbol(const char *name,
231 return ks->value; 231 return ks->value;
232 } 232 }
233 233
234 /* Now try modules. */ 234 /* Now try modules. */
235 list_for_each_entry(mod, &modules, list) { 235 list_for_each_entry(mod, &modules, list) {
236 *owner = mod; 236 *owner = mod;
237 ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms); 237 ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
@@ -285,7 +285,7 @@ static unsigned long __find_symbol(const char *name,
285 } 285 }
286 } 286 }
287 DEBUGP("Failed to find symbol %s\n", name); 287 DEBUGP("Failed to find symbol %s\n", name);
288 return 0; 288 return 0;
289} 289}
290 290
291/* Search for module by name: must hold module_mutex. */ 291/* Search for module by name: must hold module_mutex. */
@@ -441,7 +441,7 @@ static int percpu_modinit(void)
441 } 441 }
442 442
443 return 0; 443 return 0;
444} 444}
445__initcall(percpu_modinit); 445__initcall(percpu_modinit);
446#else /* ... !CONFIG_SMP */ 446#else /* ... !CONFIG_SMP */
447static inline void *percpu_modalloc(unsigned long size, unsigned long align, 447static inline void *percpu_modalloc(unsigned long size, unsigned long align,
@@ -483,8 +483,8 @@ static int modinfo_##field##_exists(struct module *mod) \
483} \ 483} \
484static void free_modinfo_##field(struct module *mod) \ 484static void free_modinfo_##field(struct module *mod) \
485{ \ 485{ \
486 kfree(mod->field); \ 486 kfree(mod->field); \
487 mod->field = NULL; \ 487 mod->field = NULL; \
488} \ 488} \
489static struct module_attribute modinfo_##field = { \ 489static struct module_attribute modinfo_##field = { \
490 .attr = { .name = __stringify(field), .mode = 0444 }, \ 490 .attr = { .name = __stringify(field), .mode = 0444 }, \
@@ -990,7 +990,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
990 struct module_sect_attrs *sect_attrs; 990 struct module_sect_attrs *sect_attrs;
991 struct module_sect_attr *sattr; 991 struct module_sect_attr *sattr;
992 struct attribute **gattr; 992 struct attribute **gattr;
993 993
994 /* Count loaded sections and allocate structures */ 994 /* Count loaded sections and allocate structures */
995 for (i = 0; i < nsect; i++) 995 for (i = 0; i < nsect; i++)
996 if (sechdrs[i].sh_flags & SHF_ALLOC) 996 if (sechdrs[i].sh_flags & SHF_ALLOC)
@@ -1348,14 +1348,14 @@ static int verify_export_symbols(struct module *mod)
1348 const unsigned long *crc; 1348 const unsigned long *crc;
1349 1349
1350 for (i = 0; i < mod->num_syms; i++) 1350 for (i = 0; i < mod->num_syms; i++)
1351 if (__find_symbol(mod->syms[i].name, &owner, &crc, 1)) { 1351 if (__find_symbol(mod->syms[i].name, &owner, &crc, 1)) {
1352 name = mod->syms[i].name; 1352 name = mod->syms[i].name;
1353 ret = -ENOEXEC; 1353 ret = -ENOEXEC;
1354 goto dup; 1354 goto dup;
1355 } 1355 }
1356 1356
1357 for (i = 0; i < mod->num_gpl_syms; i++) 1357 for (i = 0; i < mod->num_gpl_syms; i++)
1358 if (__find_symbol(mod->gpl_syms[i].name, &owner, &crc, 1)) { 1358 if (__find_symbol(mod->gpl_syms[i].name, &owner, &crc, 1)) {
1359 name = mod->gpl_syms[i].name; 1359 name = mod->gpl_syms[i].name;
1360 ret = -ENOEXEC; 1360 ret = -ENOEXEC;
1361 goto dup; 1361 goto dup;
@@ -1929,7 +1929,7 @@ static struct module *load_module(void __user *umod,
1929 mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; 1929 mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr;
1930 1930
1931#ifdef CONFIG_MODVERSIONS 1931#ifdef CONFIG_MODVERSIONS
1932 if ((mod->num_syms && !crcindex) || 1932 if ((mod->num_syms && !crcindex) ||
1933 (mod->num_gpl_syms && !gplcrcindex) || 1933 (mod->num_gpl_syms && !gplcrcindex) ||
1934 (mod->num_gpl_future_syms && !gplfuturecrcindex) || 1934 (mod->num_gpl_future_syms && !gplfuturecrcindex) ||
1935 (mod->num_unused_syms && !unusedcrcindex) || 1935 (mod->num_unused_syms && !unusedcrcindex) ||
@@ -2016,7 +2016,7 @@ static struct module *load_module(void __user *umod,
2016 if (err < 0) 2016 if (err < 0)
2017 goto arch_cleanup; 2017 goto arch_cleanup;
2018 2018
2019 err = mod_sysfs_setup(mod, 2019 err = mod_sysfs_setup(mod,
2020 (struct kernel_param *) 2020 (struct kernel_param *)
2021 sechdrs[setupindex].sh_addr, 2021 sechdrs[setupindex].sh_addr,
2022 sechdrs[setupindex].sh_size 2022 sechdrs[setupindex].sh_size
@@ -2028,8 +2028,8 @@ static struct module *load_module(void __user *umod,
2028 2028
2029 /* Size of section 0 is 0, so this works well if no unwind info. */ 2029 /* Size of section 0 is 0, so this works well if no unwind info. */
2030 mod->unwind_info = unwind_add_table(mod, 2030 mod->unwind_info = unwind_add_table(mod,
2031 (void *)sechdrs[unwindex].sh_addr, 2031 (void *)sechdrs[unwindex].sh_addr,
2032 sechdrs[unwindex].sh_size); 2032 sechdrs[unwindex].sh_size);
2033 2033
2034 /* Get rid of temporary copy */ 2034 /* Get rid of temporary copy */
2035 vfree(hdr); 2035 vfree(hdr);
@@ -2146,7 +2146,7 @@ static inline int within(unsigned long addr, void *start, unsigned long size)
2146 */ 2146 */
2147static inline int is_arm_mapping_symbol(const char *str) 2147static inline int is_arm_mapping_symbol(const char *str)
2148{ 2148{
2149 return str[0] == '$' && strchr("atd", str[1]) 2149 return str[0] == '$' && strchr("atd", str[1])
2150 && (str[2] == '\0' || str[2] == '.'); 2150 && (str[2] == '\0' || str[2] == '.');
2151} 2151}
2152 2152
@@ -2161,11 +2161,11 @@ static const char *get_ksymbol(struct module *mod,
2161 /* At worse, next value is at end of module */ 2161 /* At worse, next value is at end of module */
2162 if (within(addr, mod->module_init, mod->init_size)) 2162 if (within(addr, mod->module_init, mod->init_size))
2163 nextval = (unsigned long)mod->module_init+mod->init_text_size; 2163 nextval = (unsigned long)mod->module_init+mod->init_text_size;
2164 else 2164 else
2165 nextval = (unsigned long)mod->module_core+mod->core_text_size; 2165 nextval = (unsigned long)mod->module_core+mod->core_text_size;
2166 2166
2167 /* Scan for closest preceeding symbol, and next symbol. (ELF 2167 /* Scan for closest preceeding symbol, and next symbol. (ELF
2168 starts real symbols at 1). */ 2168 starts real symbols at 1). */
2169 for (i = 1; i < mod->num_symtab; i++) { 2169 for (i = 1; i < mod->num_symtab; i++) {
2170 if (mod->symtab[i].st_shndx == SHN_UNDEF) 2170 if (mod->symtab[i].st_shndx == SHN_UNDEF)
2171 continue; 2171 continue;
@@ -2407,7 +2407,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
2407 list_for_each_entry(mod, &modules, list) { 2407 list_for_each_entry(mod, &modules, list) {
2408 if (mod->num_exentries == 0) 2408 if (mod->num_exentries == 0)
2409 continue; 2409 continue;
2410 2410
2411 e = search_extable(mod->extable, 2411 e = search_extable(mod->extable,
2412 mod->extable + mod->num_exentries - 1, 2412 mod->extable + mod->num_exentries - 1,
2413 addr); 2413 addr);
@@ -2417,7 +2417,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
2417 preempt_enable(); 2417 preempt_enable();
2418 2418
2419 /* Now, if we found one, we are running inside it now, hence 2419 /* Now, if we found one, we are running inside it now, hence
2420 we cannot unload the module, hence no refcnt needed. */ 2420 we cannot unload the module, hence no refcnt needed. */
2421 return e; 2421 return e;
2422} 2422}
2423 2423