diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-03 04:20:33 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-03 04:20:33 +0100 |
commit | 197202d435bcb3df7268c8fbb66c05ff78e645ac (patch) | |
tree | 289553aaff73d369cb86c3a99fe6a25d246f51a5 | |
parent | 9341fd2d300e97f2bcf8e4b804c918240de4fe33 (diff) |
modprobe: remove 2k limit on /proc/cmdline
function old new delta
do_modprobe 365 520 +155
parse_and_add_kcmdline_module_options 149 - -149
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | modutils/modprobe.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 0cfb365b6..f511bc2ed 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -230,20 +230,17 @@ static const char *humanly_readable_name(struct module_entry *m) static char *parse_and_add_kcmdline_module_options(char *options, const char *modulename) { - /* defined in arch/<architecture>/include/asm/setup.h - * (maximum is 2048 for IA64 and SPARC) */ - char kcmdline_buf[2048]; + char *kcmdline_buf; char *kcmdline; char *kptr; int len; - len = open_read_close("/proc/cmdline", kcmdline_buf, 2047); - if (len <= 0) + kcmdline_buf = xmalloc_open_read_close("/proc/cmdline", NULL); + if (!kcmdline_buf) return options; - kcmdline_buf[len] = '\0'; - len = strlen(modulename); kcmdline = kcmdline_buf; + len = strlen(modulename); while ((kptr = strsep(&kcmdline, "\n\t ")) != NULL) { if (strncmp(modulename, kptr, len) != 0) continue; @@ -257,6 +254,7 @@ static char *parse_and_add_kcmdline_module_options(char *options, const char *mo options = gather_options_str(options, kptr); } } + free(kcmdline_buf); return options; } |