Skip to content

Commit 26d052b

Browse files
oberparrustyrussell
authored andcommitted
param: allow whitespace as kernel parameter separator
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 <oberpar@linux.vnet.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 554bdfe commit 26d052b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎kernel/params.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/device.h>
2424
#include <linux/err.h>
2525
#include <linux/slab.h>
26+
#include <linux/ctype.h>
2627

2728
#if 0
2829
#define DEBUGP printk
@@ -87,7 +88,7 @@ static char *next_arg(char *args, char **param, char **val)
8788
}
8889

8990
for (i = 0; args[i]; i++) {
90-
if (args[i] == ' ' && !in_quote)
91+
if (isspace(args[i]) && !in_quote)
9192
break;
9293
if (equals == 0) {
9394
if (args[i] == '=')
@@ -121,7 +122,7 @@ static char *next_arg(char *args, char **param, char **val)
121122
next = args + i;
122123

123124
/* Chew up trailing spaces. */
124-
while (*next == ' ')
125+
while (isspace(*next))
125126
next++;
126127
return next;
127128
}
@@ -138,7 +139,7 @@ int parse_args(const char *name,
138139
DEBUGP("Parsing ARGS: %s\n", args);
139140

140141
/* Chew leading spaces */
141-
while (*args == ' ')
142+
while (isspace(*args))
142143
args++;
143144

144145
while (*args) {

0 commit comments

Comments
 (0)