lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4fabdf584ad18d6aae61e331f783a5020567f634.1505231820.git.msuchanek@suse.de>
Date:   Tue, 12 Sep 2017 18:01:44 +0200
From:   Michal Suchanek <msuchanek@...e.de>
To:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Jonathan Corbet <corbet@....net>, Jessica Yu <jeyu@...nel.org>,
        Rusty Russell <rusty@...tcorp.com.au>,
        Jason Baron <jbaron@...mai.com>,
        Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
        Hari Bathini <hbathini@...ux.vnet.ibm.com>,
        Michal Suchanek <msuchanek@...e.de>,
        Daniel Axtens <dja@...ens.net>,
        Nicholas Piggin <npiggin@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Michael Neuling <mikey@...ling.org>,
        Thiago Jung Bauermann <bauerman@...ux.vnet.ibm.com>,
        "Sylvain 'ythier' Hitier" <sylvain.hitier@...il.com>,
        David Howells <dhowells@...hat.com>,
        Ingo Molnar <mingo@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Steven Rostedt," <rostedt@...dmis.org>,
        Michal Hocko <mhocko@...e.com>,
        Laura Abbott <lauraa@...eaurora.org>,
        Tejun Heo <tj@...nel.org>,
        Tom Lendacky <thomas.lendacky@....com>,
        Viresh Kumar <viresh.kumar@...aro.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: [PATCH v8 6/6] powerpc/fadump: use the new parse_args callback arguments

Signed-off-by: Michal Suchanek <msuchanek@...e.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;
 }
-- 
2.10.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ