Message ID | 20221024093817.3003291-1-tongtiangen@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp341416wru; Mon, 24 Oct 2022 02:18:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bEYQRA3SjZJzJSBTBXW/8850Tfd9BiH0xj8q00AG3GtYtHMS9E4jQ/cjIa3xk1x/WXKZT X-Received: by 2002:a05:6a00:1a07:b0:541:6060:705d with SMTP id g7-20020a056a001a0700b005416060705dmr32952805pfv.61.1666603105137; Mon, 24 Oct 2022 02:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666603105; cv=none; d=google.com; s=arc-20160816; b=z8TCFGwSUwi4TezOFL5uiN5KTGNGkBC3EDrziH0Mes0ftN1j6mRAwagJDcxFOd0vnW kvDNNkYtJOo/EKo2r2B3D7q6xxJXdGrew2BgcS4Em5AfhJeqgdvVikWpghTlXbzUmGJn 91W8+387EJ4R7n1l1udwUn10Wm2yGp8+SMuRgpmuHs2gFo682hNrqG696IiKSSiXaJFw UECn9/IYU217GX/YFd6oul5Kzt7MJ47GC3s1lNM5BToDbjKa927NmeZYCaA/t/ZDxzCz QVAnTi+dT0o8NiUnavcDTXYj1PUyypYannJZziBg87ac6JJs9HUoQdRLMmIH5ZeWPwiT vRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rjKtHFoIKCUA4OVYwCxCbh62/toC3MgpjesSx2sGQ7Q=; b=GX6o/8XE24fHEPKXvsKp+Rqhu40GmdGxBYFMDwlmy0sDOUt0UXiadxBTh83YUiiDDd IXLXlJPZWwGVTBX3xKMPYaBeNjXGSRiy3/RdxsxyTXVrH1rgjT8l5vFoQe89b5OuN8RE +8wJM3TVZcEgyX7luhL5yGUj+Y/+1Kn4nmS4x8MwgSXAbojM25roiwAiotuQxjVZWDnI zyhfhm7tUfwo1NF3C4shC6OZN5x9GukzoMadxr6Ipo9ypfIuAs853zwIcP6YCW6BF/a9 F9hHjthhdi+d1B04P/p4gFfFYEmzObgUQoEGgpRGblWBmWNiuiLRg7UDVZSkS0zWDihW TYdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902ec8800b001837ff673d3si6085467plg.262.2022.10.24.02.18.11; Mon, 24 Oct 2022 02:18:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230151AbiJXJMo (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 05:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbiJXJMm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 05:12:42 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72EF8537FD for <linux-kernel@vger.kernel.org>; Mon, 24 Oct 2022 02:12:41 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Mwq3T44Syz15M19; Mon, 24 Oct 2022 17:07:49 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 24 Oct 2022 17:12:39 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 24 Oct 2022 17:12:38 +0800 From: Tong Tiangen <tongtiangen@huawei.com> To: Mark Rutland <mark.rutland@arm.com>, <linux-kernel@vger.kernel.org>, <will@kernel.org>, <ardb@kernel.org>, <linux-arm-kernel@lists.infradead.org> CC: Tong Tiangen <tongtiangen@huawei.com>, <wangkefeng.wang@huawei.com>, Guohanjun <guohanjun@huawei.com> Subject: [PATCH -next] init/main: Use strtobool for param parsing in set_debug_rodata() Date: Mon, 24 Oct 2022 09:38:17 +0000 Message-ID: <20221024093817.3003291-1-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747560017345898917?= X-GMAIL-MSGID: =?utf-8?q?1747560017345898917?= |
Series |
[-next] init/main: Use strtobool for param parsing in set_debug_rodata()
|
|
Commit Message
Tong Tiangen
Oct. 24, 2022, 9:38 a.m. UTC
Aftern parsing "full", we can still use strtobool rather than "on" and
"off" parsing in set_debug_rodata().
Fixes: 2e8cff0a0eee ("arm64: fix rodata=full")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
---
init/main.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
Comments
On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote: > Aftern parsing "full", we can still use strtobool rather than "on" and > "off" parsing in set_debug_rodata(). > > Fixes: 2e8cff0a0eee ("arm64: fix rodata=full") Why do you think this is a fix; what do you believe is broken? As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use strtobool() here so that we don't accept garbage values like "ful". NAK to this patch as it stands. Thanks, Mark. > Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> > --- > init/main.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/init/main.c b/init/main.c > index aa21add5f7c5..f420e20b1fa3 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str) > if (arch_parse_debug_rodata(str)) > return 0; > > - if (str && !strcmp(str, "on")) > - rodata_enabled = true; > - else if (str && !strcmp(str, "off")) > - rodata_enabled = false; > - else > - pr_warn("Invalid option string for rodata: '%s'\n", str); > - return 0; > + return strtobool(str, &rodata_enabled); > } > early_param("rodata", set_debug_rodata); > #endif > -- > 2.25.1 >
在 2022/10/24 19:00, Mark Rutland 写道: > On Mon, Oct 24, 2022 at 09:38:17AM +0000, Tong Tiangen wrote: >> Aftern parsing "full", we can still use strtobool rather than "on" and >> "off" parsing in set_debug_rodata(). >> >> Fixes: 2e8cff0a0eee ("arm64: fix rodata=full") > > Why do you think this is a fix; what do you believe is broken? > > As noted in the commit message for 2e8cff0a0eee, we *deliberately* don't use > strtobool() here so that we don't accept garbage values like "ful". > > NAK to this patch as it stands. > > Thanks, > Mark. Hi Mark: Ok, missing that. Thanks, Tong. > >> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> >> --- >> init/main.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/init/main.c b/init/main.c >> index aa21add5f7c5..f420e20b1fa3 100644 >> --- a/init/main.c >> +++ b/init/main.c >> @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str) >> if (arch_parse_debug_rodata(str)) >> return 0; >> >> - if (str && !strcmp(str, "on")) >> - rodata_enabled = true; >> - else if (str && !strcmp(str, "off")) >> - rodata_enabled = false; >> - else >> - pr_warn("Invalid option string for rodata: '%s'\n", str); >> - return 0; >> + return strtobool(str, &rodata_enabled); >> } >> early_param("rodata", set_debug_rodata); >> #endif >> -- >> 2.25.1 >> > > .
diff --git a/init/main.c b/init/main.c index aa21add5f7c5..f420e20b1fa3 100644 --- a/init/main.c +++ b/init/main.c @@ -1463,13 +1463,7 @@ static int __init set_debug_rodata(char *str) if (arch_parse_debug_rodata(str)) return 0; - if (str && !strcmp(str, "on")) - rodata_enabled = true; - else if (str && !strcmp(str, "off")) - rodata_enabled = false; - else - pr_warn("Invalid option string for rodata: '%s'\n", str); - return 0; + return strtobool(str, &rodata_enabled); } early_param("rodata", set_debug_rodata); #endif