]> err.no Git - linux-2.6/commitdiff
Simplify module_get_kallsym() by dropping length arg
authorAlexey Dobriyan <adobriyan@sw.ru>
Tue, 8 May 2007 07:28:38 +0000 (00:28 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:15:08 +0000 (11:15 -0700)
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>
include/linux/module.h
kernel/kallsyms.c
kernel/module.c

index f0b0faf42d5d7c99b376a5873387f75695d088f2..7999302166268bcd4f9a4af3ff42a82eaa960a5d 100644 (file)
@@ -373,7 +373,7 @@ int is_module_address(unsigned long addr);
 /* Returns module and fills in value, defined and namebuf, or NULL if
    symnum out of range. */
 struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
-                               char *type, char *name, size_t namelen);
+                               char *type, char *name);
 
 /* Look for this name: can be of form module:name. */
 unsigned long module_kallsyms_lookup_name(const char *name);
@@ -529,8 +529,7 @@ static inline const char *module_address_lookup(unsigned long addr,
 
 static inline struct module *module_get_kallsym(unsigned int symnum,
                                                unsigned long *value,
-                                               char *type, char *name,
-                                               size_t namelen)
+                                               char *type, char *name)
 {
        return NULL;
 }
index 5a0de8409739588a0710cb46f204d8cb262f77a9..d086c91d44edb8a0c89e95b5b0ebd1ea4005a52d 100644 (file)
@@ -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;
 
index 9bdbd1217a6f2eec4ed775dd42357acac1f51b82..43a529a1fa487b62fc570f2a08a2585c8274068b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/moduleloader.h>
 #include <linux/init.h>
+#include <linux/kallsyms.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
@@ -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;
                }