Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755976AbdLOVmD (ORCPT ); Fri, 15 Dec 2017 16:42:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:60018 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755650AbdLOVmB (ORCPT ); Fri, 15 Dec 2017 16:42:01 -0500 From: Michal Suchanek To: Hari Bathini , linuxppc-dev , Andrew Morton , Ankit Kumar , lkml , Mahesh J Salgaonkar Cc: Michal Suchanek Subject: [PATCH] Fix parse_args cycle limit check. Date: Fri, 15 Dec 2017 22:41:49 +0100 Message-Id: <20171215214149.3692-1-msuchanek@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171215214702.7c7afba1@kitsune.suse.cz> References: <20171215214702.7c7afba1@kitsune.suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1180 Lines: 50 Actually args are supposed to be renamed to next so both and args hold the previous argument so both can be passed to the callback. This additionla patch should fix up the rename. --- kernel/params.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/params.c b/kernel/params.c index 69ff58e69887..efb4dfaa6bc5 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -182,17 +182,18 @@ char *parse_args(const char *doing, if (*args) pr_debug("doing %s, parsing ARGS: '%s'\n", doing, args); + else + return err; - next = next_arg(args, ¶m, &val); - while (*next) { + do { int ret; int irq_was_disabled; - args = next; next = next_arg(args, ¶m, &val); + /* Stop at -- */ if (!val && strcmp(param, "--") == 0) - return err ?: args; + return err ?: next; irq_was_disabled = irqs_disabled(); ret = parse_one(param, val, args, next, doing, params, num, min_level, max_level, arg, unknown); @@ -215,9 +216,10 @@ char *parse_args(const char *doing, doing, val ?: "", param); break; } - err = ERR_PTR(ret); - } + + args = next; + } while (*args); return err; } -- 2.13.6