Commit a0f448ec authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] boot parameters: quoting of environment variables revisited

As noticed by Joey Hess (and thanks for Christoph for forwarding it).  Also
requirements from Werner Almesberger.

If someone passes 'foo="some value"' the param engine removes the quotes
and hands 'foo' and 'some value'.  The __setup() parameters expect a single
string, and so we try to regenerate it from the two parts.  Finally, we try
to place it as an environment variable.

Werner wants quotes stripped out of the environment variable.  It makes
sense to do that for __setup, too (so it sees 'foo=some value'), since
__setup functions don't usually handle quotes.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1857599a
......@@ -287,8 +287,15 @@ static int __init unknown_bootoption(char *param, char *val)
{
/* Change NUL term back to "=", to make "param" the whole string. */
if (val) {
if (val[-1] == '"') val[-2] = '=';
else val[-1] = '=';
/* param=val or param="val"? */
if (val == param+strlen(param)+1)
val[-1] = '=';
else if (val == param+strlen(param)+2) {
val[-2] = '=';
memmove(val-1, val, strlen(val)+1);
val--;
} else
BUG();
}
/* Handle obsolete-style parameters */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment