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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E8A7C433F5 for ; Mon, 21 Feb 2022 05:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237440AbiBUFJa (ORCPT ); Mon, 21 Feb 2022 00:09:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbiBUFJZ (ORCPT ); Mon, 21 Feb 2022 00:09:25 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13FE82AC49 for ; Sun, 20 Feb 2022 21:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Aan7Ujt8/26/llcROptH3G+O4UQo5JXTq4g/ACt8qmM=; b=fMUpvHgDjRlR/V+713pt/ofPFI jipUpvE9Qxfxto0S7An8hLh2xqRjOzFgc/N5yHbej0wf1ACce/EIRUJbx9RJXb62Q7j/My+Tb/vW5 bZMbkdrREtD/XE1CMlbT7xnw03uEElIHJca0Azel6kkwrG7XJi+UccfbKygKsKSMC+iFZ6PNHzUk2 Pe5iDnZjQU0l/2dsSZI24ImBRmewZJhXE2+RA1VQgZNYzDfb7bouMr0XSCJJJFPPgDUFO1arlejEy aex4vIgHou/f5avkkOPEdJxHqkwwPzBaiJDhEA/oDuqB1gQ/IGPn/F4Fgdc6ZgP+FN1hfPb0zOKpS oSsyHf8g==; Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nM0wY-003U7X-KY; Mon, 21 Feb 2022 05:09:02 +0000 From: Randy Dunlap To: linux-kernel@vger.kernel.org Cc: Randy Dunlap , Igor Zhbanov , Ingo Molnar , Andrew Morton , Greg Kroah-Hartman Subject: [PATCH 2/2] init/main.c: return 1 from handled __setup() functions Date: Sun, 20 Feb 2022 21:09:01 -0800 Message-Id: <20220221050901.23985-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Cc: Ingo Molnar Cc: Andrew Morton Cc: Greg Kroah-Hartman --- init/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- linux-next-20220217.orig/init/main.c +++ linux-next-20220217/init/main.c @@ -1195,7 +1195,7 @@ static int __init initcall_blacklist(cha } } while (str_entry); - return 0; + return 1; } static bool __init_or_module initcall_blacklisted(initcall_t fn) @@ -1455,7 +1455,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