From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: Michal Suchanek <msuchanek@suse.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Jonathan Corbet <corbet@lwn.net>, Jessica Yu <jeyu@kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Jason Baron <jbaron@akamai.com>,
Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>,
Daniel Axtens <dja@axtens.net>,
Nicholas Piggin <npiggin@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michael Neuling <mikey@neuling.org>,
Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>,
"Sylvain 'ythier' Hitier" <sylvain.hitier@gmail.com>,
David Howells <dhowells@redhat.com>,
Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Steven Rostedt," <rostedt@goodmis.org>,
Michal Hocko <mhocko@suse.com>,
Laura Abbott <lauraa@codeaurora.org>, Tejun Heo <tj@kernel.org>,
Tom Lendacky <thomas.lendacky@amd.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Lokesh Vutla <lokeshvutla@ti.com>, Baoquan He <bhe@redhat.com>,
Ilya Matveychikov <matvejchikov@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 6/6] powerpc/fadump: use the new parse_args callback arguments
Date: Fri, 29 Sep 2017 18:30:13 +0530 [thread overview]
Message-ID: <12256349-cdac-8e66-699f-095873ed2809@linux.vnet.ibm.com> (raw)
In-Reply-To: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de>
In case, someone wishes for a changelog:
With fadump_rework_cmdline_params() function, parse_args() callback
function,
taking new arguments - current & next, use them to process
'fadump_extra_args='
parmeter, in enforcing the parameters passed through it for fadump kernel.
On Tuesday 12 September 2017 09:31 PM, Michal Suchanek wrote:
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
> arch/powerpc/kernel/fadump.c | 47 ++++++++++++--------------------------------
> 1 file changed, 13 insertions(+), 34 deletions(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 8778e1cc0380..1678d99ea835 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -481,33 +481,19 @@ struct param_info {
> };
>
> static void __init fadump_update_params(struct param_info *param_info,
> - char *param, char *val)
> + char *param, char *val,
> + char *currant, char *next)
> {
> - ptrdiff_t param_offset = param - param_info->tmp_cmdline;
> + ptrdiff_t param_offset = currant - param_info->tmp_cmdline;
> size_t vallen = val ? strlen(val) : 0;
> char *tgt = param_info->cmdline + param_offset
> - param_info->shortening;
> - int shortening = 0;
> - int quoted = 0;
> + int shortening = ((next - 1) - (currant))
> + - (FADUMP_EXTRA_ARGS_LEN + 1 + vallen);
>
> if (!val)
> return;
>
> - /* leading '"' removed from parameter */
> - if ((param > param_info->tmp_cmdline) && *(param - 1) == '"') {
> - quoted = 1;
> - shortening += 1;
> - tgt--;
> - }
> -
> - /* next_arg removes one leading and one trailing '"' */
> - if ((*(tgt + FADUMP_EXTRA_ARGS_LEN + 1 + vallen + shortening) == '"') &&
> - (quoted || (*(tgt + FADUMP_EXTRA_ARGS_LEN + 1) == '"'))) {
> - shortening += 1;
> - if (!quoted)
> - shortening += 1;
> - }
> -
> /* remove one leading and one trailing quote if both are present */
> if ((val[0] == '"') && (val[vallen - 1] == '"')) {
> shortening += 2;
> @@ -515,22 +501,15 @@ static void __init fadump_update_params(struct param_info *param_info,
> val++;
> }
>
> - /* some characters were removed - move the trailing part of cmdline */
> - if (shortening) {
> - char *src;
> + strncpy(tgt, FADUMP_EXTRA_ARGS_PARAM, FADUMP_EXTRA_ARGS_LEN);
> + tgt += FADUMP_EXTRA_ARGS_LEN;
> + *tgt++ = ' ';
> + strncpy(tgt, val, vallen);
> + tgt += vallen;
>
> - strncpy(tgt, FADUMP_EXTRA_ARGS_PARAM, FADUMP_EXTRA_ARGS_LEN);
> - tgt += FADUMP_EXTRA_ARGS_LEN;
> - *tgt++ = ' ';
> -
> - strncpy(tgt, val, vallen);
> - tgt += vallen;
> -
> - src = tgt + shortening;
> + if (shortening) {
> + char *src = tgt + shortening;
> memmove(tgt, src, strlen(src) + 1);
> - } else {
> - /* remove the '=' */
> - *(tgt + FADUMP_EXTRA_ARGS_LEN) = ' ';
> }
>
> param_info->shortening += shortening;
> @@ -550,7 +529,7 @@ static int __init fadump_rework_cmdline_params(char *param, char *val,
> strlen(FADUMP_EXTRA_ARGS_PARAM) - 1))
> return 0;
>
> - fadump_update_params(param_info, param, val);
> + fadump_update_params(param_info, param, val, currant, next);
>
> return 0;
> }
Thanks
Hari
next prev parent reply other threads:[~2017-09-29 13:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 16:01 [PATCH v8 1/6] powerpc/fadump: reduce memory consumption for capture kernel Michal Suchanek
2017-09-12 16:01 ` [PATCH v8 2/6] powerpc/fadump: update documentation about 'fadump_extra_args=' parameter Michal Suchanek
2017-09-12 16:01 ` [PATCH v8 3/6] lib/cmdline.c: Remove quotes symmetrically Michal Suchanek
2017-09-12 16:01 ` [PATCH v8 4/6] powerpc/fadump: update the dequoting logic to match lib/cmdline.c Michal Suchanek
2017-09-12 16:01 ` [PATCH v8 5/6] boot/param: add pointer to current and next argument to unknown parameter callback Michal Suchanek
2017-09-12 16:01 ` [PATCH v8 6/6] powerpc/fadump: use the new parse_args callback arguments Michal Suchanek
2017-09-15 17:02 ` [PATCH 1/6] lib/cmdline.c: Add backslash support to kernel commandline parsing Michal Suchanek
2017-09-15 17:14 ` Al Viro
2017-09-15 17:28 ` Michal Suchánek
2017-09-25 18:39 ` Michal Suchánek
2017-09-15 17:02 ` [PATCH 2/6] Documentation/admin-guide: backslash support in commandline Michal Suchanek
2017-09-15 17:02 ` [PATCH 3/6] powerpc/fadump: stop removing quotes in argument parsing Michal Suchanek
2017-09-15 17:02 ` [PATCH 4/6] powerpc/fadump: Update fadump ducumentation on quoting arguments Michal Suchanek
2017-09-15 17:02 ` [PATCH 5/6] lib/cmdline.c: Implement single quotes in commandline argument parsing Michal Suchanek
2017-09-15 17:02 ` [PATCH 6/6] Documentation/admin-guide: single quotes in kernel arguments Michal Suchanek
2017-09-15 17:59 ` Randy Dunlap
2017-09-25 18:40 ` Michal Suchánek
2017-09-29 13:00 ` Hari Bathini [this message]
2017-09-27 10:31 ` [PATCH v8 1/6] powerpc/fadump: reduce memory consumption for capture kernel Hari Bathini
2017-09-27 10:45 ` Hari Bathini
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=12256349-cdac-8e66-699f-095873ed2809@linux.vnet.ibm.com \
--to=hbathini@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bauerman@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=bhe@redhat.com \
--cc=corbet@lwn.net \
--cc=dhowells@redhat.com \
--cc=dja@axtens.net \
--cc=jbaron@akamai.com \
--cc=jeyu@kernel.org \
--cc=keescook@chromium.org \
--cc=lauraa@codeaurora.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lokeshvutla@ti.com \
--cc=mahesh@linux.vnet.ibm.com \
--cc=matvejchikov@gmail.com \
--cc=mhocko@suse.com \
--cc=mikey@neuling.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=sylvain.hitier@gmail.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tj@kernel.org \
--cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).