Commit 26d052bfce799ef0e7262695b46e3525ca4d381d

Authored by Peter Oberparleiter
Committed by Rusty Russell
1 parent 554bdfe5ac

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>

Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff

... ... @@ -23,6 +23,7 @@
23 23 #include <linux/device.h>
24 24 #include <linux/err.h>
25 25 #include <linux/slab.h>
  26 +#include <linux/ctype.h>
26 27  
27 28 #if 0
28 29 #define DEBUGP printk
... ... @@ -87,7 +88,7 @@
87 88 }
88 89  
89 90 for (i = 0; args[i]; i++) {
90   - if (args[i] == ' ' && !in_quote)
  91 + if (isspace(args[i]) && !in_quote)
91 92 break;
92 93 if (equals == 0) {
93 94 if (args[i] == '=')
... ... @@ -121,7 +122,7 @@
121 122 next = args + i;
122 123  
123 124 /* Chew up trailing spaces. */
124   - while (*next == ' ')
  125 + while (isspace(*next))
125 126 next++;
126 127 return next;
127 128 }
... ... @@ -138,7 +139,7 @@
138 139 DEBUGP("Parsing ARGS: %s\n", args);
139 140  
140 141 /* Chew leading spaces */
141   - while (*args == ' ')
  142 + while (isspace(*args))
142 143 args++;
143 144  
144 145 while (*args) {