From patchwork Tue Nov 1 21:14:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13027478 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 6EC4EC433FE for ; Tue, 1 Nov 2022 21:15:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 698D86B0071; Tue, 1 Nov 2022 17:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 648D86B0073; Tue, 1 Nov 2022 17:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5107E6B0074; Tue, 1 Nov 2022 17:15:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3FB396B0071 for ; Tue, 1 Nov 2022 17:15:26 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EB6E514096E for ; Tue, 1 Nov 2022 21:15:25 +0000 (UTC) X-FDA: 80086129410.08.EB00990 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by imf06.hostedemail.com (Postfix) with ESMTP id 79BE9180012 for ; Tue, 1 Nov 2022 21:15:25 +0000 (UTC) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id pyanoKD2rsfCIpybToWfKU; Tue, 01 Nov 2022 22:15:24 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 01 Nov 2022 22:15:24 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: SeongJae Park , Andrew Morton Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , damon@lists.linux.dev, linux-mm@kvack.org Subject: [PATCH 20/30] mm/damon: Use kstrtobool() instead of strtobool() Date: Tue, 1 Nov 2022 22:14:08 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.jaillet@wanadoo.fr designates 80.12.242.16 as permitted sender) smtp.mailfrom=christophe.jaillet@wanadoo.fr; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667337325; a=rsa-sha256; cv=none; b=R8cZOE8PkZFwd25LXhU+i3SGcM3x5HXii/cMO7phkiIzxkz+z3ThDlCB26Zv1eBf1zHG5a Ya8K+xv9Czk2r4QU7XqlmR7Qu5e5/1/B1Kd0iX5I/JDqChXoBrYJ1xyfGbAGpQ4506CzwV t7sbeL6/KCjo9N9qgXSegP/v8eOystQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667337325; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X5psvRSj26Xy4mfCNSxtmrWL90PAhEIbVrMEtk5ocRo=; b=WM+WMjrxUAm/PswcbH8rsRt6f3EvH02ObqBggZcPosujN0+ICcqngvdFLLnDSPjoiJDyyK tEn63lsR2eY+8Kj9uLNR+8Tb59YBFFjtWB0fowPtOET+hnFIJiC4va4YWyrMZJNEN5/OoZ 6j4wkgGfLDwU0/dv3yRro4eRumav0TY= X-Stat-Signature: h68yrgirsgzxu5n3rgcegmkxppabpu85 X-Rspamd-Queue-Id: 79BE9180012 Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of christophe.jaillet@wanadoo.fr designates 80.12.242.16 as permitted sender) smtp.mailfrom=christophe.jaillet@wanadoo.fr; dmarc=none X-Rspamd-Server: rspam03 X-Rspam-User: X-HE-Tag: 1667337325-842146 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: strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel. In order to remove strtobool() and slightly simplify kstrtox.h, switch to the other function name. While at it, include the corresponding header file () Signed-off-by: Christophe JAILLET Reviewed-by: SeongJae Park --- This patch is part of a serie that axes all usages of strtobool(). Each patch can be applied independently from the other ones. The last patch of the serie removes the definition of strtobool(). You may not be in copy of the cover letter. So, if needed, it is available at [1]. [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/ --- mm/damon/lru_sort.c | 3 ++- mm/damon/reclaim.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 2a532e3983df..7b8fce2f67a8 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) "damon-lru-sort: " fmt #include +#include #include #include "modules-common.h" @@ -241,7 +242,7 @@ static int damon_lru_sort_enabled_store(const char *val, bool enable; int err; - err = strtobool(val, &enable); + err = kstrtobool(val, &enable); if (err) return err; diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index e57604bec06d..e82631f39481 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) "damon-reclaim: " fmt #include +#include #include #include "modules-common.h" @@ -187,7 +188,7 @@ static int damon_reclaim_enabled_store(const char *val, bool enable; int err; - err = strtobool(val, &enable); + err = kstrtobool(val, &enable); if (err) return err; From patchwork Tue Nov 1 21:14:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13027479 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 2E65CC4332F for ; Tue, 1 Nov 2022 21:15:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 450BD6B0073; Tue, 1 Nov 2022 17:15:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D8406B0074; Tue, 1 Nov 2022 17:15:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 279846B0075; Tue, 1 Nov 2022 17:15:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 18D6A6B0073 for ; Tue, 1 Nov 2022 17:15:27 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B82EA40ADD for ; Tue, 1 Nov 2022 21:15:26 +0000 (UTC) X-FDA: 80086129452.29.F2F376F Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by imf19.hostedemail.com (Postfix) with ESMTP id 305CA1A0042 for ; Tue, 1 Nov 2022 21:15:25 +0000 (UTC) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id pyanoKD2rsfCIpybUoWfKf; Tue, 01 Nov 2022 22:15:24 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 01 Nov 2022 22:15:24 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Pasha Tatashin , Andrew Morton , Kees Cook Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mm@kvack.org, linux-hardening@vger.kernel.org Subject: [PATCH 21/30] mm: Use kstrtobool() instead of strtobool() Date: Tue, 1 Nov 2022 22:14:09 +0100 Message-Id: <03f9401a6c8b87a1c786a2138d16b048f8d0eb53.1667336095.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of christophe.jaillet@wanadoo.fr designates 80.12.242.16 as permitted sender) smtp.mailfrom=christophe.jaillet@wanadoo.fr; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667337326; a=rsa-sha256; cv=none; b=eiQftvRkPY0+/7wAvQEVl4CyOO4xCUvz2Mmw6BEXuYacq/ee5+zyqmZqLL1LVC7LY67b8G dowBpbZnMhP1/RRraEZQqp3OOQ8EhKDgmVeSLM6CbDsvpxu3DRbzdjnim5Ucx2zJC0LLEU COcwWFrrYw0c48otBLjIayMpgRetaSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667337326; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pI0R7ahbwYCPKtvjPQzg5QzcH2XvT3CW8LFnB87t8Nk=; b=Qcx8oSFR84C90NZ/cBfunzNrCeGHPR18s8u25UdYJZ8IKMMups6mu/MlT3To5d7a6Mn9E0 V8YkwJBSdUmCczmFivRyGgGL8IguMW8fvsFlgTZFIstyt4+5wmS+NEOSv1HW9AFnwUBkM9 Mv6spJnu/zeY8MZqUfSrGCvjY+z0NCQ= X-Stat-Signature: ufoqo7htjmgm7odcqh6byxsg8u13yrnq X-Rspamd-Queue-Id: 305CA1A0042 Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of christophe.jaillet@wanadoo.fr designates 80.12.242.16 as permitted sender) smtp.mailfrom=christophe.jaillet@wanadoo.fr; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1667337325-370926 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: strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel. In order to remove strtobool() and slightly simplify kstrtox.h, switch to the other function name. While at it, include the corresponding header file () Signed-off-by: Christophe JAILLET Reviewed-by: Kees Cook Acked-by: Pasha Tatashin --- This patch is part of a serie that axes all usages of strtobool(). Each patch can be applied independently from the other ones. The last patch of the serie removes the definition of strtobool(). You may not be in copy of the cover letter. So, if needed, it is available at [1]. [1]: https://lore.kernel.org/all/cover.1667336095.git.christophe.jaillet@wanadoo.fr/ --- mm/page_table_check.c | 3 ++- mm/usercopy.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 433dbce13fe1..93e633c1d587 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -4,6 +4,7 @@ * Copyright (c) 2021, Google LLC. * Pasha Tatashin */ +#include #include #include @@ -23,7 +24,7 @@ EXPORT_SYMBOL(page_table_check_disabled); static int __init early_page_table_check_param(char *buf) { - return strtobool(buf, &__page_table_check_enabled); + return kstrtobool(buf, &__page_table_check_enabled); } early_param("page_table_check", early_page_table_check_param); diff --git a/mm/usercopy.c b/mm/usercopy.c index c1ee15a98633..4c3164beacec 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -258,7 +259,7 @@ static bool enable_checks __initdata = true; static int __init parse_hardened_usercopy(char *str) { - if (strtobool(str, &enable_checks)) + if (kstrtobool(str, &enable_checks)) pr_warn("Invalid option string for hardened_usercopy: '%s'\n", str); return 1;