[v8,4/6] powerpc/fadump: update the dequoting logic to match lib/cmdline.c

Message ID 490bce7afcb8ae57880cb83d5cf1a07ba1a0fc60.1505231820.git.msuchanek@suse.de
State New
Headers show
Series
  • [v8,1/6] powerpc/fadump: reduce memory consumption for capture kernel
Related show

Commit Message

Michal Suchánek Sept. 12, 2017, 4:01 p.m.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 arch/powerpc/kernel/fadump.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 0e08f1a80af2..b214c1e333dd 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -501,10 +501,12 @@  static void __init fadump_update_params(struct param_info *param_info,
 	}
 
 	/* next_arg removes one leading and one trailing '"' */
-	if (*(tgt + FADUMP_EXTRA_ARGS_LEN + 1) == '"')
-		shortening += 1;
-	if (*(tgt + FADUMP_EXTRA_ARGS_LEN + 1 + vallen + shortening) == '"')
+	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] == '"')) {