From mboxrd@z Thu Jan 1 00:00:00 1970 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 EAD7BC00144 for ; Fri, 29 Jul 2022 15:17:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 130B36B0071; Fri, 29 Jul 2022 11:17:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E0648E0002; Fri, 29 Jul 2022 11:17:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEA698E0001; Fri, 29 Jul 2022 11:17:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E0B976B0071 for ; Fri, 29 Jul 2022 11:17:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B7DCE811E9 for ; Fri, 29 Jul 2022 15:17:45 +0000 (UTC) X-FDA: 79740492090.26.8D0BE81 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf06.hostedemail.com (Postfix) with ESMTP id 3493918009C for ; Fri, 29 Jul 2022 15:17:44 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id sz17so9073526ejc.9 for ; Fri, 29 Jul 2022 08:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8uOzxUeHyhbXm38NMH0o9xKNocW39uZURlmCfdDfHVQ=; b=X5JFM6ncTKhP0dvBkT3+YMgOXuX7B74bsPN/NF0g+oPNYeC1Ct5yDA690tfkf1XHu7 GwVt67m+Jb57vP0D/EEdsBmctPZCaptJeV7rTU8Jo/I1sqdIPycTLh0uIArioQ59k/4W MIa4fLHpde6VL+mfDFfo/+Pt09NJvWxRLImMv0CuoWiggS5ADBEBOAFchKqPnlENnmKV 2j7EsqvvumTYVHn7dnmOpYTrv55QmTZ3Bjf00AmvFMyy2/rRV58cXuOhGPev4PTmpwVY uemEFnPVxYNOrretMEd0T+AOIYDo8r9/wOLrt3kcmw/YYN1EX/tPDbu906tCsFAZvaPT V8PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8uOzxUeHyhbXm38NMH0o9xKNocW39uZURlmCfdDfHVQ=; b=qIPPYMaA5L/Z6Ht36fBEA8A6YLgDGM1BDiBjpmQ7JA17LnMBgUX8hTKIYhHi4z5Z/K edQ3f9+YmWuqJ43HEtIMBVZmR49b8UAIe7xWb/ej0dtyZpLpwndO33oLqGW7ApSIkWkg iAwSJz+6NepYzlinSr890wIuBTe7Y0fPrqOYT41gjGctnZ/6GllvyV4dI0bT3sCwDSNE fQKgEcyuNrTDrd+HPj3eFL9qMCaSybHp93r255Cd5aH/5y+4CyA3sbbplb4S7jg2iRtM 1wB4HL4t+T9XXK/a4b4FbfnXhfKbWLmipH6qq/CEC2t8qKfhAub3c7Jmu49jtYzYyxM9 vRWA== X-Gm-Message-State: AJIora/2JKOqIf/z+n52INnenVNJEiJs+sChW6Yn3nmrMHxVoIyFyDfx ezNQY9cxeGmVZaNSWbPz2Q== X-Google-Smtp-Source: AGRyM1unZD4CDaqGRE4CcewGTDSkgkSwfbx6+pGS5X/ZxyjvhfDPVd5wl1V9pG7ZMKxGNSQeMm5MRQ== X-Received: by 2002:a17:907:3ea6:b0:72b:4a06:989a with SMTP id hs38-20020a1709073ea600b0072b4a06989amr3359081ejc.168.1659107862822; Fri, 29 Jul 2022 08:17:42 -0700 (PDT) Received: from localhost.localdomain ([46.53.249.83]) by smtp.gmail.com with ESMTPSA id c12-20020a056402120c00b0043cc2c9f5adsm2433441edw.40.2022.07.29.08.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 08:17:40 -0700 (PDT) Date: Fri, 29 Jul 2022 18:17:38 +0300 From: Alexey Dobriyan To: Andy Shevchenko Cc: Matthew Wilcox , Mark Rutland , Jagdish Gediya , linux-kernel@vger.kernel.org, linux-mm@kvack.org, ying.huang@intel.com, dave.hansen@intel.com, Jonathan.Cameron@huawei.com, akpm@linux-foundation.org, rf@opensource.cirrus.com, pmladek@suse.com, will@kernel.org Subject: Re: [PATCH v3 1/2] lib/kstrtox.c: Add "false"/"true" support to kstrtobool() Message-ID: References: <20220426180203.70782-1-jvgediya@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=X5JFM6nc; spf=pass (imf06.hostedemail.com: domain of adobriyan@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=adobriyan@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659107864; a=rsa-sha256; cv=none; b=dhhzPE4PGK60Ec6aJWJdLtxYfWG9oW2YKINzL8bteuoGIjU86NQICndQ+o22qhmfZI9z8E ZjWfBmJyI+lbf4FDgU42D1BMo6mq58ACgZ3KoVt2zcLr+2K4y3o3AjWWG3RlzGTGXsCQ/y 50Zt4orwQSjrfLb4eWrM3EqEPqUVnP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659107864; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8uOzxUeHyhbXm38NMH0o9xKNocW39uZURlmCfdDfHVQ=; b=mXInc+LtYnfH5fV2p9uAYQD9KHS3PWIMrFUB0eKqLcqQFEmcrep8wyy/HWinRfSPPAl1/W IH8W9uTEgzaS0DOZESmtHyG+/2dNGCdTMK6YUPMKXhIsJ85mBCVFFAI/Uq+1PjT+NDG+IA xRQmUXUB2yFdsWLPjl6LwS/KiHWmVoE= X-Rspamd-Queue-Id: 3493918009C Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=X5JFM6nc; spf=pass (imf06.hostedemail.com: domain of adobriyan@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=adobriyan@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam01 X-Rspam-User: X-Stat-Signature: 5dmqay5u1jj5jy93by3fibbzuj7brspu X-HE-Tag: 1659107864-528954 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: On Fri, Jul 29, 2022 at 05:35:26PM +0300, Andy Shevchenko wrote: > On Mon, Jul 25, 2022 at 04:21:11PM +0100, Matthew Wilcox wrote: > > On Mon, Jul 25, 2022 at 03:55:27PM +0100, Mark Rutland wrote: > > > On Tue, Apr 26, 2022 at 11:32:02PM +0530, Jagdish Gediya wrote: > > > > At many places in kernel, It is necessary to convert sysfs input > > > > to corrosponding bool value e.g. "false" or "0" need to be converted > > > > to bool false, "true" or "1" need to be converted to bool true, > > > > places where such conversion is needed currently check the input > > > > string manually, kstrtobool() can be utilized at such places but > > > > currently it doesn't have support to accept "false"/"true". > > > > > > > > Add support to accept "false"/"true" as valid string in kstrtobool(). > > > > > > > > Signed-off-by: Jagdish Gediya > > > > Reviewed-by: Matthew Wilcox (Oracle) > > > > > > I've just spotted that this broke arm64's "rodata=full" command line option, > > > > That isn't a documented option. > > > > rodata= [KNL] > > on Mark read-only kernel memory as read-only (default). > > off Leave read-only kernel memory writable for debugging. > > > > Hopefully this is an object lesson in why you need to update the > > documentation when you extend a feature. > > > > > since "full" gets parsed as 'f' = FALSE, when previously that would have been > > > rejected. So anyone passing "rodata=full" on the command line will have rodata > > > disabled, which is not what they wanted. > > > > > > The current state of things is a bit messy (we prase the option twice because > > > arch code needs it early), and we can probably fix that with some refactoring, > > > but I do wonder if we actually want to open up the sysfs parsing to accept > > > anything *beginning* with [tTfF] rather than the full "true" and "false" > > > strings as previously, or whether it's worth reverting this for now in case > > > anything else is affected. > > > > Well, that's going to break people who've started using the new option. > > As a quick fix, how about only allowing either "f\0" or "fa"? > > I think we need to be more strict in kstrtobool(), i.e. 'f\0' ('t\0') and 'fal' > ('tru') perhaps? lol what? the only way to be strict is to accept "0" and "1" with optional newline and delete all the rubbish entirely.