From patchwork Wed Mar 23 23:06:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12790219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E88EC433F5 for ; Wed, 23 Mar 2022 23:06:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 369998D000A; Wed, 23 Mar 2022 19:06:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31B4D6B0083; Wed, 23 Mar 2022 19:06:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E07A8D000A; Wed, 23 Mar 2022 19:06:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 100126B0082 for ; Wed, 23 Mar 2022 19:06:18 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BAB078249980 for ; Wed, 23 Mar 2022 23:06:17 +0000 (UTC) X-FDA: 79277186394.31.C53EB76 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 2019B2001D for ; Wed, 23 Mar 2022 23:06:16 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A47D617D5; Wed, 23 Mar 2022 23:06:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A453C36AF5; Wed, 23 Mar 2022 23:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648076775; bh=mZzWohm32Mk4wIVFFd0R9wbB44+Mbz7tzFrxU1t0AcI=; h=Date:To:From:In-Reply-To:Subject:From; b=dUSXqz5xym9acVBsvG/1vSRbxWsOcX9lmLTC+ggnuKp4GjwI6XB02BrlSNVEzMcsR ZD16j8fzOE+iJjRe2k4jW5+6KlBdHcffa5yWmYwh2pcceDPanCRRH6vqlWYprkSrJJ VAQdeoXPC4vLWfEGWOJEWB5K9t44GU50xItZf2r8= Date: Wed, 23 Mar 2022 16:06:14 -0700 To: mingo@kernel.org,i.zhbanov@omprussia.ru,gregkh@linuxfoundation.org,rdunlap@infradead.org,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220323160453.65922ced539cbf445b191555@linux-foundation.org> Subject: [patch 19/41] init/main.c: return 1 from handled __setup() functions Message-Id: <20220323230615.5A453C36AF5@smtp.kernel.org> Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=dUSXqz5x; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2019B2001D X-Stat-Signature: cu18j7eszfw5ahp65eqtzomynw73f81f X-HE-Tag: 1648076776-35827 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Randy Dunlap Subject: init/main.c: return 1 from handled __setup() functions initcall_blacklist() should return 1 to indicate that it handled its cmdline arguments. set_debug_rodata() should return 1 to indicate that it handled its cmdline arguments. Print a warning if the option string is invalid. This prevents these strings from being added to the 'init' program's environment as they are not init arguments/parameters. Link: https://lkml.kernel.org/r/20220221050901.23985-1-rdunlap@infradead.org Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Cc: Ingo Molnar Cc: Greg Kroah-Hartman Signed-off-by: Andrew Morton --- init/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/init/main.c~init-mainc-return-1-from-handled-__setup-functions +++ a/init/main.c @@ -1190,7 +1190,7 @@ static int __init initcall_blacklist(cha } } while (str_entry); - return 0; + return 1; } static bool __init_or_module initcall_blacklisted(initcall_t fn) @@ -1448,7 +1448,9 @@ static noinline void __init kernel_init_ bool rodata_enabled __ro_after_init = true; static int __init set_debug_rodata(char *str) { - return strtobool(str, &rodata_enabled); + if (strtobool(str, &rodata_enabled)) + pr_warn("Invalid option string for rodata: '%s'\n", str); + return 1; } __setup("rodata=", set_debug_rodata); #endif