[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87valdut2g.fsf@concordia.ellerman.id.au>
Date: Thu, 24 Aug 2017 21:02:47 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Michal Suchanek <msuchanek@...e.de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Jonathan Corbet <corbet@....net>, Jessica Yu <jeyu@...nel.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Jason Baron <jbaron@...mai.com>,
Hari Bathini <hbathini@...ux.vnet.ibm.com>,
Mahesh J Salgaonkar <mahesh@...ux.vnet.ibm.com>,
Daniel Axtens <dja@...ens.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Suchanek <msuchanek@...e.de>,
Thiago Jung Bauermann <bauerman@...ux.vnet.ibm.com>,
Balbir Singh <bsingharora@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Michael Neuling <mikey@...ling.org>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Christophe Leroy <christophe.leroy@....fr>,
Scott Wood <oss@...error.net>,
Oliver O'Halloran <oohall@...il.com>,
David Howells <dhowells@...hat.com>,
Sylvain 'ythier' Hitier <sylvain.hitier@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Kees Cook <keescook@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: "Steven Rostedt\," <rostedt@...dmis.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Tejun Heo <tj@...nel.org>, Lokesh Vutla <lokeshvutla@...com>,
Baoquan He <bhe@...hat.com>,
Ilya Matveychikov <matvejchikov@...il.com>,
linuxppc-dev@...ts.ozlabs.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 3/4] lib/cmdline.c Remove quotes symmetrically.
Michal Suchanek <msuchanek@...e.de> writes:
> Remove quotes from argument value only if there is qoute on both sides.
>
> Signed-off-by: Michal Suchanek <msuchanek@...e.de>
> ---
> arch/powerpc/kernel/fadump.c | 6 ++----
> lib/cmdline.c | 7 ++-----
Can you split that into two patches?
cheers
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index a1614d9b8a21..d7da4ce9f7ae 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -489,10 +489,8 @@ static void __init fadump_update_params(struct param_info *param_info,
> *tgt++ = ' ';
>
> /* next_arg removes one leading and one trailing '"' */
> - if (*tgt == '"')
> - shortening += 1;
> - if (*(tgt + vallen + shortening) == '"')
> - shortening += 1;
> + if ((*tgt == '"') && (*(tgt + vallen + shortening) == '"'))
> + shortening += 2;
>
> /* remove one leading and one trailing quote if both are present */
> if ((val[0] == '"') && (val[vallen - 1] == '"')) {
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 4c0888c4a68d..01e701b2afe8 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -227,14 +227,11 @@ char *next_arg(char *args, char **param, char **val)
> *val = args + equals + 1;
>
> /* Don't include quotes in value. */
> - if (**val == '"') {
> + if ((**val == '"') && (args[i-1] == '"')) {
> (*val)++;
> - if (args[i-1] == '"')
> - args[i-1] = '\0';
> + args[i-1] = '\0';
> }
> }
> - if (quoted && args[i-1] == '"')
> - args[i-1] = '\0';
>
> if (args[i]) {
> args[i] = '\0';
> --
> 2.10.2
Powered by blists - more mailing lists