]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
module: fix the module name length in param_sysfs_builtin
authorDenis Cheng <crquan@gmail.com>
Mon, 21 Jan 2008 09:08:25 +0000 (17:08 +0800)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 29 Jan 2008 06:13:24 +0000 (17:13 +1100)
the original code use KOBJ_NAME_LEN for built-in module name length,
that's defined to 20 in linux/kobject.h, but this is not enough appearntly,
many module names are longer than this;
 #define KOBJ_NAME_LEN                   20

another macro is MODULE_NAME_LEN defined in linux/module.h, I think this is
enough for module names:
 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))

Signed-off-by: Denis Cheng <crquan@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
kernel/params.c

index 67f65ee7211de8fa79311ca4141fdd96b9426765..42fe5e6126c0948e5b6859f5fcc75ebb71e2b039 100644 (file)
@@ -376,8 +376,6 @@ int param_get_string(char *buffer, struct kernel_param *kp)
 
 extern struct kernel_param __start___param[], __stop___param[];
 
-#define MAX_KBUILD_MODNAME KOBJ_NAME_LEN
-
 struct param_attribute
 {
        struct module_attribute mattr;
@@ -587,7 +585,7 @@ static void __init param_sysfs_builtin(void)
 {
        struct kernel_param *kp, *kp_begin = NULL;
        unsigned int i, name_len, count = 0;
-       char modname[MAX_KBUILD_MODNAME + 1] = "";
+       char modname[MODULE_NAME_LEN + 1] = "";
 
        for (i=0; i < __stop___param - __start___param; i++) {
                char *dot;
@@ -595,12 +593,12 @@ static void __init param_sysfs_builtin(void)
 
                kp = &__start___param[i];
                max_name_len =
-                       min_t(size_t, MAX_KBUILD_MODNAME, strlen(kp->name));
+                       min_t(size_t, MODULE_NAME_LEN, strlen(kp->name));
 
                dot = memchr(kp->name, '.', max_name_len);
                if (!dot) {
                        DEBUGP("couldn't find period in first %d characters "
-                              "of %s\n", MAX_KBUILD_MODNAME, kp->name);
+                              "of %s\n", MODULE_NAME_LEN, kp->name);
                        continue;
                }
                name_len = dot - kp->name;