Skip to content

Commit

Permalink
Merge tag 'modules-for-v4.12' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/jeyu/linux

Pull modules updates from Jessica Yu:

 - Minor code cleanups

 - Fix section alignment for .init_array

* tag 'modules-for-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
  kallsyms: Use bounded strnchr() when parsing string
  module: Unify the return value type of try_module_get
  module: set .init_array alignment to 8
  • Loading branch information
Linus Torvalds committed May 4, 2017
2 parents 4c17468 + 1758618 commit a1be8ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ extern bool try_module_get(struct module *module);
extern void module_put(struct module *module);

#else /*!CONFIG_MODULE_UNLOAD*/
static inline int try_module_get(struct module *module)
static inline bool try_module_get(struct module *module)
{
return !module || module_is_live(module);
}
Expand Down Expand Up @@ -680,9 +680,9 @@ static inline void __module_get(struct module *module)
{
}

static inline int try_module_get(struct module *module)
static inline bool try_module_get(struct module *module)
{
return 1;
return true;
}

static inline void module_put(struct module *module)
Expand Down
2 changes: 1 addition & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -4035,7 +4035,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)

/* Don't lock: we're in enough trouble already. */
preempt_disable();
if ((colon = strchr(name, ':')) != NULL) {
if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {
if ((mod = find_module_all(name, colon - name, false)) != NULL)
ret = mod_find_symname(mod, colon+1);
} else {
Expand Down
3 changes: 1 addition & 2 deletions scripts/module-common.lds
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ SECTIONS {
__kcrctab_unused_gpl 0 : { *(SORT(___kcrctab_unused_gpl+*)) }
__kcrctab_gpl_future 0 : { *(SORT(___kcrctab_gpl_future+*)) }

. = ALIGN(8);
.init_array 0 : { *(SORT(.init_array.*)) *(.init_array) }
.init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }

__jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) }
}

0 comments on commit a1be8ed

Please sign in to comment.