[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f0d9664cf6e10cd89c8fa551885b91a75619b267.1528215659.git.msuchanek@suse.de>
Date: Tue, 5 Jun 2018 18:43:10 +0200
From: Michal Suchanek <msuchanek@...e.de>
To: Jonathan Corbet <corbet@....net>,
Michal Suchanek <msuchanek@...e.de>,
Arnd Bergmann <arnd@...db.de>,
Frederic Weisbecker <frederic@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Aaron Wu <Aaron.Wu@...log.com>,
Tony Luck <tony.luck@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"Steven Rostedt," <rostedt@...dmis.org>,
Laura Abbott <lauraa@...eaurora.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Alexey Dobriyan <adobriyan@...il.com>,
Tom Lendacky <thomas.lendacky@....com>,
Jeffrey Hugo <jhugo@...eaurora.org>,
Baoquan He <bhe@...hat.com>,
Ilya Matveychikov <matvejchikov@...il.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v10 3/5] init/main.c: simplify repair_env_string.
Quoting characters are now removed from the parameter so value always
follows directly after the NUL terminating parameter name.
Signed-off-by: Michal Suchanek <msuchanek@...e.de>
---
init/main.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/init/main.c b/init/main.c
index 4bc2819d97ad..d0f4a7a0f010 100644
--- a/init/main.c
+++ b/init/main.c
@@ -251,15 +251,10 @@ static int __init repair_env_string(char *param, char *val,
const char *unused, void *arg)
{
if (val) {
- /* 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();
+ int parm_len = strlen(param);
+
+ param[parm_len] = '=';
+ BUG_ON(val != param + parm_len + 1);
}
return 0;
}
--
2.13.6
Powered by blists - more mailing lists