aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2007-05-08 03:28:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:08 -0400
commitae84e324709d6320ed8c1fd7b1736fcbaf26df95 (patch)
treebb3b623f2fd491771c716957622a72e86e9582dd /kernel
parent55955aad7c09e4d93029d0cf2d360b41891f2fe4 (diff)
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 <adobriyan@sw.ru> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kallsyms.c2
-rw-r--r--kernel/module.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 5a0de8409739..d086c91d44ed 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -312,7 +312,7 @@ static int get_ksymbol_mod(struct kallsym_iter *iter)
312{ 312{
313 iter->owner = module_get_kallsym(iter->pos - kallsyms_num_syms, 313 iter->owner = module_get_kallsym(iter->pos - kallsyms_num_syms,
314 &iter->value, &iter->type, 314 &iter->value, &iter->type,
315 iter->name, sizeof(iter->name)); 315 iter->name);
316 if (iter->owner == NULL) 316 if (iter->owner == NULL)
317 return 0; 317 return 0;
318 318
diff --git a/kernel/module.c b/kernel/module.c
index 9bdbd1217a6f..43a529a1fa48 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -19,6 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/moduleloader.h> 20#include <linux/moduleloader.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kallsyms.h>
22#include <linux/kernel.h> 23#include <linux/kernel.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
@@ -2124,7 +2125,7 @@ const char *module_address_lookup(unsigned long addr,
2124} 2125}
2125 2126
2126struct module *module_get_kallsym(unsigned int symnum, unsigned long *value, 2127struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
2127 char *type, char *name, size_t namelen) 2128 char *type, char *name)
2128{ 2129{
2129 struct module *mod; 2130 struct module *mod;
2130 2131
@@ -2134,7 +2135,7 @@ struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
2134 *value = mod->symtab[symnum].st_value; 2135 *value = mod->symtab[symnum].st_value;
2135 *type = mod->symtab[symnum].st_info; 2136 *type = mod->symtab[symnum].st_info;
2136 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, 2137 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name,
2137 namelen); 2138 KSYM_NAME_LEN + 1);
2138 mutex_unlock(&module_mutex); 2139 mutex_unlock(&module_mutex);
2139 return mod; 2140 return mod;
2140 } 2141 }