Skip to content

Commit

Permalink
param: allow whitespace as kernel parameter separator
Browse files Browse the repository at this point in the history
Some boot mechanisms require that kernel parameters are stored in a
separate file which is loaded to memory without further processing
(e.g. the "Load from FTP" method on s390). When such a file contains
newline characters, the kernel parameter preceding the newline might
not be correctly parsed (due to the newline being stuck to the end of
the actual parameter value) which can lead to boot failures.

This patch improves kernel command line usability in such a situation
by allowing generic whitespace characters as separators between kernel
parameters.

Signed-off-by: Peter Oberparleiter <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
oberpar authored and rustyrussell committed Sep 24, 2009
1 parent 554bdfe commit 26d052b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/ctype.h>

#if 0
#define DEBUGP printk
Expand Down Expand Up @@ -87,7 +88,7 @@ static char *next_arg(char *args, char **param, char **val)
}

for (i = 0; args[i]; i++) {
if (args[i] == ' ' && !in_quote)
if (isspace(args[i]) && !in_quote)
break;
if (equals == 0) {
if (args[i] == '=')
Expand Down Expand Up @@ -121,7 +122,7 @@ static char *next_arg(char *args, char **param, char **val)
next = args + i;

/* Chew up trailing spaces. */
while (*next == ' ')
while (isspace(*next))
next++;
return next;
}
Expand All @@ -138,7 +139,7 @@ int parse_args(const char *name,
DEBUGP("Parsing ARGS: %s\n", args);

/* Chew leading spaces */
while (*args == ' ')
while (isspace(*args))
args++;

while (*args) {
Expand Down

0 comments on commit 26d052b

Please sign in to comment.