From ae84e324709d6320ed8c1fd7b1736fcbaf26df95 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 8 May 2007 00:28:38 -0700 Subject: Simplify module_get_kallsym() by dropping length arg module_get_kallsym() could in theory truncate module symbol name to fit in buffer, but nobody does this. Always use KSYM_NAME_LEN + 1 bytes for name. Suggested by lg^WRusty. Signed-off-by: Alexey Dobriyan Acked-by: Rusty Russell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/kallsyms.c | 2 +- kernel/module.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'kernel') diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 5a0de84..d086c91 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -312,7 +312,7 @@ static int get_ksymbol_mod(struct kallsym_iter *iter) { iter->owner = module_get_kallsym(iter->pos - kallsyms_num_syms, &iter->value, &iter->type, - iter->name, sizeof(iter->name)); + iter->name); if (iter->owner == NULL) return 0; diff --git a/kernel/module.c b/kernel/module.c index 9bdbd12..43a529a 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -2124,7 +2125,7 @@ const char *module_address_lookup(unsigned long addr, } struct module *module_get_kallsym(unsigned int symnum, unsigned long *value, - char *type, char *name, size_t namelen) + char *type, char *name) { struct module *mod; @@ -2134,7 +2135,7 @@ struct module *module_get_kallsym(unsigned int symnum, unsigned long *value, *value = mod->symtab[symnum].st_value; *type = mod->symtab[symnum].st_info; strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, - namelen); + KSYM_NAME_LEN + 1); mutex_unlock(&module_mutex); return mod; } -- cgit v1.1