From: Andrew Morton <akpm@linux-foundation.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Masami Hiramatsu <mhiramat@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bootconfig: do not put quotes on cmdline items unless necessary
Date: Wed, 6 Mar 2024 12:42:11 -0800 [thread overview]
Message-ID: <20240306124211.b490ea3c2372d89cff8c287c@linux-foundation.org> (raw)
In-Reply-To: <20240306122452.1664709-1-linux@rasmusvillemoes.dk>
On Wed, 6 Mar 2024 13:24:52 +0100 Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> When trying to migrate to using bootconfig to embed the kernel's and
> PID1's command line with the kernel image itself, and so allowing
> changing that without modifying the bootloader, I noticed that
> /proc/cmdline changed from e.g.
>
> console=ttymxc0,115200n8 cma=128M quiet -- --log-level=notice
>
> to
>
> console="ttymxc0,115200n8" cma="128M" quiet -- --log-level="notice"
>
> The kernel parameters are parsed just fine, and the quotes are indeed
> stripped from the actual argv[] given to PID1. However, the quoting
> doesn't really serve any purpose and looks excessive, and might
> confuse some (naive) userspace tool trying to parse /proc/cmdline. So
> do not quote the value unless it contains whitespace.
>
> ...
>
> --- a/init/main.c
> +++ b/init/main.c
> @@ -319,12 +319,20 @@ static char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
>
> #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0)
>
> +static int has_space(const char *v)
> +{
> + for (; *v; v++)
> + if (isspace(*v))
> + return 1;
> + return 0;
> +}
Do we already have something which does this?
Could do strchr(' ')||strchr('\t')
Do we really support tab separation here? I doubt if that gets used or
tested much.
This function could be __init.
next prev parent reply other threads:[~2024-03-06 20:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 12:24 Rasmus Villemoes
2024-03-06 20:42 ` Andrew Morton [this message]
2024-03-07 8:10 ` Rasmus Villemoes
2024-03-07 8:18 ` Rasmus Villemoes
2024-03-08 5:41 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306124211.b490ea3c2372d89cff8c287c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®