aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modutils/modprobe.c12
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)
230 230
231static char *parse_and_add_kcmdline_module_options(char *options, const char *modulename) 231static char *parse_and_add_kcmdline_module_options(char *options, const char *modulename)
232{ 232{
233 /* defined in arch/<architecture>/include/asm/setup.h 233 char *kcmdline_buf;
234 * (maximum is 2048 for IA64 and SPARC) */
235 char kcmdline_buf[2048];
236 char *kcmdline; 234 char *kcmdline;
237 char *kptr; 235 char *kptr;
238 int len; 236 int len;
239 237
240 len = open_read_close("/proc/cmdline", kcmdline_buf, 2047); 238 kcmdline_buf = xmalloc_open_read_close("/proc/cmdline", NULL);
241 if (len <= 0) 239 if (!kcmdline_buf)
242 return options; 240 return options;
243 kcmdline_buf[len] = '\0';
244 241
245 len = strlen(modulename);
246 kcmdline = kcmdline_buf; 242 kcmdline = kcmdline_buf;
243 len = strlen(modulename);
247 while ((kptr = strsep(&kcmdline, "\n\t ")) != NULL) { 244 while ((kptr = strsep(&kcmdline, "\n\t ")) != NULL) {
248 if (strncmp(modulename, kptr, len) != 0) 245 if (strncmp(modulename, kptr, len) != 0)
249 continue; 246 continue;
@@ -257,6 +254,7 @@ static char *parse_and_add_kcmdline_module_options(char *options, const char *mo
257 options = gather_options_str(options, kptr); 254 options = gather_options_str(options, kptr);
258 } 255 }
259 } 256 }
257 free(kcmdline_buf);
260 258
261 return options; 259 return options;
262} 260}