Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1007468ybc; Sat, 23 Nov 2019 13:11:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxhfmqd6Ec4RgdZnPcBk3BGPJRuGwzl33SWKzxx9Sa7alGh156k8wct32U/RWes5/zQPRYW X-Received: by 2002:aa7:c987:: with SMTP id c7mr8965244edt.232.1574543486679; Sat, 23 Nov 2019 13:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574543486; cv=none; d=google.com; s=arc-20160816; b=wTr2BmY/cEsdIlft+yN1jRD+AxObnTpFCMLJQSTUyK4rF2kVBRb8VgsWWtsPMmCgwr 65fGPkgolJPqejo1Q247EoBT+TQrqV4QWZ09E2xrr3IUK4DcxDlz7SlIzwAESw9vBAv0 7BqbTLSNFFxJ4Jc4oseEnU0pRoqo3vUOvGOKzDZNXLe+z1ekM9c+5t2iTMVgUXDkwRlI 3cOGVUrbbwklRvPfOcR8IA6MojCrGI8X2kwur+DHrqpGdhY/KClhGf3DtjurDHyZkb5d W6F0KNoXMFRnA8dXzKYKdmLPThzBuEZUcOYyy+z7hTaUU50fhAat1LreziyzwppUPy80 UI4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=U73ogPu5oQ0nNykSJGRun0NX2DnBSnxUQ+74Mv45tWo=; b=sEE4hs5H9anAMi92Gz3hzu+zAUMS6cqSX9l2Xm4ff7bQjlhpPvFIn5/G2vPFcYAXOJ dHfEc5KtByfH/YQoOVQ21VXfgsMfdMSrr1EyHf9cohCoZaEfttMLKUDg/mmyptIW4reQ zF+02o5YhKRuFPGLHkaV6NmsF5MW+Wn54I+XtUXhq0DFsmGzEWEw+3042bIUyxJuIYID NjXEE/A4V7RTTPlPaoaeZDSh8PUo3Si/IuMlTdK+uJ2lMcM7WrStrVWyWCNae77fTONm eBou2+yuA0SOXRxKXru0awZ73Jntfyo2FIhrwo/eTgVyJTMvmS7hS6TkR5UqudrcyP0/ A9Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si1452538edx.350.2019.11.23.13.11.03; Sat, 23 Nov 2019 13:11:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbfKWVI1 (ORCPT + 99 others); Sat, 23 Nov 2019 16:08:27 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:32778 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbfKWVIW (ORCPT ); Sat, 23 Nov 2019 16:08:22 -0500 Received: by mail-qt1-f193.google.com with SMTP id y39so12349498qty.0 for ; Sat, 23 Nov 2019 13:08:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U73ogPu5oQ0nNykSJGRun0NX2DnBSnxUQ+74Mv45tWo=; b=mz1Nc9ZQ5pl6Ub/W2x0deR7tU3Z9NCRQSpDzy63If2S2DgDlnWQSPS3A7acArOQeGn j939LGs9OJzbFz/TOawC7YWQWp4FmA0TQiQgoNKlkBDX2/vEoRNdqg/IYnirMWmt2aWm un3U7B+yUUwflhMnQwQk++AqjcEULb2IbAgr0rIpoQ5+CojDHRYVh93Gy3yvsJv6yRIG /+5wfANHCXzFR4601CmC5lgAp7HbtmeLI9ebU0+l9zaYHJ27VGouatGoTRRxPFJoIycd InaU14m3pbuxxWV+xy4OImd3Ypu8Uu8xfa7nSZYIi7WVeQfMlIU9rZVR+vPiapf2muEn 7wFQ== X-Gm-Message-State: APjAAAWF49ttWD9qDP14mYkzQODpufqMKTYeQS8yfkZDyo1hbNawtmGU YF0t9XTulNYBlQN3Kw9jYKPnl6fWbtA= X-Received: by 2002:aed:3bf8:: with SMTP id s53mr6526653qte.373.1574543299747; Sat, 23 Nov 2019 13:08:19 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id c37sm1164978qta.56.2019.11.23.13.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Nov 2019 13:08:19 -0800 (PST) From: Arvind Sankar To: linux-kernel@vger.kernel.org, nivedita@alum.mit.edu Subject: [PATCH 2/3] init/main.c: remove unnecessary repair_env_string in do_initcall_level Date: Sat, 23 Nov 2019 16:08:07 -0500 Message-Id: <20191123210808.107904-3-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191123210808.107904-1-nivedita@alum.mit.edu> References: <20191123210808.107904-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 08746a65c296 ("init: fix in-place parameter modification regression"), parse_args in do_initcall_level is called on a copy of saved_command_line. It is unnecessary to call repair_env_string during this parsing, as this copy is not used for anything later. Remove the now unnecessary arguments from repair_env_string as well. Signed-off-by: Arvind Sankar --- init/main.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/init/main.c b/init/main.c index c92f0376b1bc..a2008e7a797f 100644 --- a/init/main.c +++ b/init/main.c @@ -246,8 +246,7 @@ static int __init loglevel(char *str) early_param("loglevel", loglevel); /* Change NUL term back to "=", to make "param" the whole string. */ -static int __init repair_env_string(char *param, char *val, - const char *unused, void *arg) +static void __init repair_env_string(char *param, char *val) { if (val) { /* param=val or param="val"? */ @@ -256,11 +255,9 @@ static int __init repair_env_string(char *param, char *val, else if (val == param+strlen(param)+2) { val[-2] = '='; memmove(val-1, val, strlen(val)+1); - val--; } else BUG(); } - return 0; } /* Anything after -- gets handed straight to init. */ @@ -272,7 +269,7 @@ static int __init set_init_arg(char *param, char *val, if (panic_later) return 0; - repair_env_string(param, val, unused, NULL); + repair_env_string(param, val); for (i = 0; argv_init[i]; i++) { if (i == MAX_INIT_ARGS) { @@ -292,7 +289,7 @@ static int __init set_init_arg(char *param, char *val, static int __init unknown_bootoption(char *param, char *val, const char *unused, void *arg) { - repair_env_string(param, val, unused, NULL); + repair_env_string(param, val); /* Handle obsolete-style parameters */ if (obsolete_checksetup(param)) @@ -990,6 +987,12 @@ static const char *initcall_level_names[] __initdata = { "late", }; +static int __init ignore_unknown_bootoption(char *param, char *val, + const char *unused, void *arg) +{ + return 0; +} + static void __init do_initcall_level(int level) { initcall_entry_t *fn; @@ -999,7 +1002,7 @@ static void __init do_initcall_level(int level) initcall_command_line, __start___param, __stop___param - __start___param, level, level, - NULL, &repair_env_string); + NULL, ignore_unknown_bootoption); trace_initcall_level(initcall_level_names[level]); for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) -- 2.23.0