* [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
@ 2008-01-21 9:08 Denis Cheng
2008-01-21 11:16 ` Rusty Russell
0 siblings, 1 reply; 7+ messages in thread
From: Denis Cheng @ 2008-01-21 9:08 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rusty Russell; +Cc: Dave Young, linux-kernel
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>
---
kernel/params.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/params.c b/kernel/params.c
index 7686417..a085b40 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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;
@@ -588,7 +586,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;
@@ -596,12 +594,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;
--
1.5.3.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
2008-01-21 9:08 [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin Denis Cheng
@ 2008-01-21 11:16 ` Rusty Russell
2008-01-22 23:13 ` Jan Engelhardt
0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2008-01-21 11:16 UTC (permalink / raw)
To: Denis Cheng; +Cc: Greg Kroah-Hartman, Dave Young, linux-kernel
On Monday 21 January 2008 20:08:25 Denis Cheng wrote:
> 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
Thanks, applied. I was surprisedto learn that we have a 35-char source
filename in the kernel.
And congratulations to nf_conntrack_l3proto_ipv4_compat.c!
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
2008-01-21 11:16 ` Rusty Russell
@ 2008-01-22 23:13 ` Jan Engelhardt
2008-01-23 1:53 ` rae l
2008-01-23 1:54 ` Rusty Russell
0 siblings, 2 replies; 7+ messages in thread
From: Jan Engelhardt @ 2008-01-22 23:13 UTC (permalink / raw)
To: Rusty Russell; +Cc: Denis Cheng, Greg Kroah-Hartman, Dave Young, linux-kernel
On Jan 21 2008 22:16, Rusty Russell wrote:
>On Monday 21 January 2008 20:08:25 Denis Cheng wrote:
>> 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
>
>Thanks, applied. I was surprisedto learn that we have a 35-char source
>filename in the kernel.
>
>And congratulations to nf_conntrack_l3proto_ipv4_compat.c!
But nf..dada_compat.c gets linked into nf_conntrack_ipv4.ko,
and that is what is used in /sys/module - and it fits the 20.
Any place where nf_conntrack_l3proto_ipv4_compat would still be used?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
2008-01-22 23:13 ` Jan Engelhardt
@ 2008-01-23 1:53 ` rae l
2008-01-23 1:54 ` Rusty Russell
1 sibling, 0 replies; 7+ messages in thread
From: rae l @ 2008-01-23 1:53 UTC (permalink / raw)
To: Jan Engelhardt
Cc: Rusty Russell, Greg Kroah-Hartman, Dave Young, linux-kernel
On Jan 23, 2008 7:13 AM, Jan Engelhardt <jengelh@computergmbh.de> wrote:
> But nf..dada_compat.c gets linked into nf_conntrack_ipv4.ko,
> and that is what is used in /sys/module - and it fits the 20.
> Any place where nf_conntrack_l3proto_ipv4_compat would still be used?
there is a module named nf_conntrack_proto_icmp.ko, length 23. and you
can find all them by:
$ make allmodconfig && make modules
$ find -name '*.ko' -printf '%f\n' |gawk '{print length($0), $0}' |sort -n
...
24 dvb-usb-af9005-remote.ko
24 dvb-usb-dibusb-common.ko
25 nf_conntrack_proto_gre.ko
26 nf_conntrack_netbios_ns.ko
26 nf_conntrack_proto_sctp.ko
29 nf_conntrack_proto_udplite.ko
so currently tha max length of module name is 26 (in
nf_conntrack_proto_udplite), but still no any length limit to module
names in Documentation/, so we have to prepare reserved space for
modules later, or mark MODULE_NAME_LEN as the modules' name length
limit in Documentation/?
Simply speaking, MODULE_NAME_LEN does the better job.
>
--
Denis Cheng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
2008-01-22 23:13 ` Jan Engelhardt
2008-01-23 1:53 ` rae l
@ 2008-01-23 1:54 ` Rusty Russell
1 sibling, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2008-01-23 1:54 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Denis Cheng, Greg Kroah-Hartman, Dave Young, linux-kernel
On Wednesday 23 January 2008 10:13:37 Jan Engelhardt wrote:
> On Jan 21 2008 22:16, Rusty Russell wrote:
> >On Monday 21 January 2008 20:08:25 Denis Cheng wrote:
> >> 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
> >
> >Thanks, applied. I was surprisedto learn that we have a 35-char source
> >filename in the kernel.
> >
> >And congratulations to nf_conntrack_l3proto_ipv4_compat.c!
>
> But nf..dada_compat.c gets linked into nf_conntrack_ipv4.ko,
> and that is what is used in /sys/module - and it fits the 20.
> Any place where nf_conntrack_l3proto_ipv4_compat would still be used?
Of course, but my point was that we already have a 35 char filename in the
kernel, and lots of > 22 chars, so increasing it is not unreasonable.
FYI make allmodconfig here gives me the following of 21 chars or longer:
dvb-usb-af9005-remote
dvb-usb-dibusb-common
nf_conntrack_netbios_ns
nf_conntrack_proto_udplite
nf_conntrack_proto_sctp
nf_conntrack_proto_gre
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
@ 2008-01-21 9:20 Denis Cheng
0 siblings, 0 replies; 7+ messages in thread
From: Denis Cheng @ 2008-01-21 9:20 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rusty Russell; +Cc: Dave Young, linux-kernel
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,
some module names(such as nf_conntrack_proto_icmp) 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>
---
kernel/params.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/params.c b/kernel/params.c
index 7686417..a085b40 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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;
@@ -588,7 +586,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;
@@ -596,12 +594,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;
--
1.5.3.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin
@ 2008-01-19 5:46 rae l
0 siblings, 0 replies; 7+ messages in thread
From: rae l @ 2008-01-19 5:46 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel
From: Denis Cheng <crquan@gmail.com>
Date: Sat, 19 Jan 2008 13:29:51 +0800
Subject: [PATCH] kernel/params.c: fix the module name length in
param_sysfs_builtin
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>
---
kernel/params.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/params.c b/kernel/params.c
index 7686417..a085b40 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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;
@@ -588,7 +586,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;
@@ -596,12 +594,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;
--
1.5.3.5
--
Denis Cheng
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-01-23 1:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-21 9:08 [PATCH] kernel/params.c: fix the module name length in param_sysfs_builtin Denis Cheng
2008-01-21 11:16 ` Rusty Russell
2008-01-22 23:13 ` Jan Engelhardt
2008-01-23 1:53 ` rae l
2008-01-23 1:54 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2008-01-21 9:20 Denis Cheng
2008-01-19 5:46 rae l
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).