Received: by 2002:a05:7412:a986:b0:f9:90c9:de9f with SMTP id o6csp6863rdh; Wed, 20 Dec 2023 12:38:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IER1ZEF4iaJAWwERx+MC1hptyzo8MyTmjYC+UBKAd+E48VdHZBwwqPnyNDf53EeO0za8AaW X-Received: by 2002:a05:6a20:3d85:b0:18f:97c:976c with SMTP id s5-20020a056a203d8500b0018f097c976cmr172946pzi.84.1703104733447; Wed, 20 Dec 2023 12:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703104733; cv=none; d=google.com; s=arc-20160816; b=tSndVdFuoN8stZ+RN1ZEBea8W/vAmY8rHKAdidhk7aCERqV7MfOeJUsFikT5DCJz3k M6OVUeiRKGr+jDH5eNyKQVfvlcKZ+IAleM2UPykidp847UhF6oM1azf3qQ2eSovzI/ll 9Y4ugSHOZgRfKr1n86T3NCfUgKj6SPZhaOOEw5WR4OjVUUZeM2HvdWiJFQMREdxg0/jV WGwrlAOHFqIYbG7QWxu0pqadJpMD+laFWUlypCn54J4UJSHftGiFjIf8AjsRHMYRlNHU 79IXlWssaMsUVvxXcJM2yJA8ZbznlCEYbN3YUGLx548uvGI7Whf7/yMTf0tWC6/fzuBr 7lAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=PHd+SLze1fskZ+L1Y4pyv1O7ocoQWZvk5lvee86HhJU=; fh=mQHYZJZ4wrrUPZSxXw43ktkjhPKUUdq/KKY3WVaSeX0=; b=Kfo/0Y/AEJcVUeJBl4fMWF8E58Y3jj54icXwB7zDweCmUJbbFZRMGN5rOiuSLjuDgo PVSa9z3a06a03egdYG1LC/Yv4xYgYv3UQhOPkFNsEpAVU6sDSDyiA6SheiQC9fA8uJ0Q wT5qxHVqgIkJaq3H2hpRxNDEKFfkEO4tzEJh40ffOQ6tTYBgPTr7TGsRZSCCsdZvcG2+ 2b94zQccBmw+uRcX8C9OJSacpaJ9pewYbJLw6UZzJkZGOGW6a4z74rvY1qJvWa2oPqL2 b315dIkTgMvsrJ9yI9zlxnsydQ6xv1MGxcnR2MDV+7FwmuelwKTgho8INEABoLZH+OII Ig3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.com header.s=s31663417 header.b=k2VWQSZD; spf=pass (google.com: domain of linux-kernel+bounces-7420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f32-20020a635120000000b005c5e2331ba9si290029pgb.324.2023.12.20.12.38.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 12:38:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.com header.s=s31663417 header.b=k2VWQSZD; spf=pass (google.com: domain of linux-kernel+bounces-7420-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7420-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 19AEA284A7D for ; Wed, 20 Dec 2023 20:38:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80ABA1DFF8; Wed, 20 Dec 2023 20:38:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.com header.i=quwenruo.btrfs@gmx.com header.b="k2VWQSZD" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6453C1DA49; Wed, 20 Dec 2023 20:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.com; s=s31663417; t=1703104696; x=1703709496; i=quwenruo.btrfs@gmx.com; bh=652STe0TburQeLYtf7tkw0BbO2YX6p6CYDiyUL+fTAo=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=k2VWQSZDZ9yJzZOppcqiYGWYEL547OKMnhwYa53rCCLAK5mDpBzq5BdZm0iMTLm/ lHoJjepEBpIGS9yAdKsb71YFQdwxBVUVUFGrS3bycnuSk1N5usUm68MNy3PiGOjb6 2qOY5f6rLWDaO5jYpUoM5kCa1GmQSLT8RKY6AfwwmE8xkvucxh6TyRU6aVEx71Q6p 5sV0W0Lhgy/v765HU8ReKXBLGFjQTzHPex8lbKzbzbwFlk/gIzI5CaP+IFCxhraIa e2ND6tcqeYVWR2Mq3lLFamXuK+oVX55VfPqWybrBlvvCdKVD/4t33tYzTTfzHaBBO FEDugH8yGU4+IkIuvw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [172.16.0.153] ([115.64.109.135]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MrQJ5-1quUTY0zqh-00oWTu; Wed, 20 Dec 2023 21:38:16 +0100 Message-ID: <15cf089f-be9a-4762-ae6b-4791efca6b44@gmx.com> Date: Thu, 21 Dec 2023 07:08:08 +1030 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] lib/strtox: introduce kstrtoull_suffix() helper To: Andy Shevchenko , Qu Wenruo Cc: Alexey Dobriyan , Andrew Morton , linux-btrfs@vger.kernel.org, Christophe JAILLET , linux-kernel@vger.kernel.org, David Sterba References: Content-Language: en-US From: Qu Wenruo Autocrypt: addr=quwenruo.btrfs@gmx.com; keydata= xsBNBFnVga8BCACyhFP3ExcTIuB73jDIBA/vSoYcTyysFQzPvez64TUSCv1SgXEByR7fju3o 8RfaWuHCnkkea5luuTZMqfgTXrun2dqNVYDNOV6RIVrc4YuG20yhC1epnV55fJCThqij0MRL 1NxPKXIlEdHvN0Kov3CtWA+R1iNN0RCeVun7rmOrrjBK573aWC5sgP7YsBOLK79H3tmUtz6b 9Imuj0ZyEsa76Xg9PX9Hn2myKj1hfWGS+5og9Va4hrwQC8ipjXik6NKR5GDV+hOZkktU81G5 gkQtGB9jOAYRs86QG/b7PtIlbd3+pppT0gaS+wvwMs8cuNG+Pu6KO1oC4jgdseFLu7NpABEB AAHNIlF1IFdlbnJ1byA8cXV3ZW5ydW8uYnRyZnNAZ214LmNvbT7CwJQEEwEIAD4CGwMFCwkI BwIGFQgJCgsCBBYCAwECHgECF4AWIQQt33LlpaVbqJ2qQuHCPZHzoSX+qAUCY00iVQUJDToH pgAKCRDCPZHzoSX+qNKACACkjDLzCvcFuDlgqCiS4ajHAo6twGra3uGgY2klo3S4JespWifr BLPPak74oOShqNZ8yWzB1Bkz1u93Ifx3c3H0r2vLWrImoP5eQdymVqMWmDAq+sV1Koyt8gXQ XPD2jQCrfR9nUuV1F3Z4Lgo+6I5LjuXBVEayFdz/VYK63+YLEAlSowCF72Lkz06TmaI0XMyj jgRNGM2MRgfxbprCcsgUypaDfmhY2nrhIzPUICURfp9t/65+/PLlV4nYs+DtSwPyNjkPX72+ LdyIdY+BqS8cZbPG5spCyJIlZonADojLDYQq4QnufARU51zyVjzTXMg5gAttDZwTH+8LbNI4 mm2YzsBNBFnVga8BCACqU+th4Esy/c8BnvliFAjAfpzhI1wH76FD1MJPmAhA3DnX5JDORcga CbPEwhLj1xlwTgpeT+QfDmGJ5B5BlrrQFZVE1fChEjiJvyiSAO4yQPkrPVYTI7Xj34FnscPj /IrRUUka68MlHxPtFnAHr25VIuOS41lmYKYNwPNLRz9Ik6DmeTG3WJO2BQRNvXA0pXrJH1fN GSsRb+pKEKHKtL1803x71zQxCwLh+zLP1iXHVM5j8gX9zqupigQR/Cel2XPS44zWcDW8r7B0 q1eW4Jrv0x19p4P923voqn+joIAostyNTUjCeSrUdKth9jcdlam9X2DziA/DHDFfS5eq4fEv ABEBAAHCwHwEGAEIACYCGwwWIQQt33LlpaVbqJ2qQuHCPZHzoSX+qAUCY00ibgUJDToHvwAK CRDCPZHzoSX+qK6vB/9yyZlsS+ijtsvwYDjGA2WhVhN07Xa5SBBvGCAycyGGzSMkOJcOtUUf tD+ADyrLbLuVSfRN1ke738UojphwkSFj4t9scG5A+U8GgOZtrlYOsY2+cG3R5vjoXUgXMP37 INfWh0KbJodf0G48xouesn08cbfUdlphSMXujCA8y5TcNyRuNv2q5Nizl8sKhUZzh4BascoK DChBuznBsucCTAGrwPgG4/ul6HnWE8DipMKvkV9ob1xJS2W4WJRPp6QdVrBWJ9cCdtpR6GbL iQi22uZXoSPv/0oUrGU+U5X4IvdnvT+8viPzszL5wXswJZfqfy8tmHM85yjObVdIG6AlnrrD In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03: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zPe2PBOq54D SKOIMOhYBOzolg7QFyUXg7ceE9MTtEuJUYBDV55nMZOLuZhzqHDmloVEZtz9mnHkU7Umg36Sw 7SqmHt54Kd151T5WbJ+d13wIlv/6peHGGYgLR9Pu0qpd12O/d4HgfAcyn2M7iwKk4TzTbuAHd m3d2xWzOhvezn/Ze7hvCCj1uZO0= On 2023/12/21 00:54, Andy Shevchenko wrote: > > On Wed, Dec 20, 2023 at 08:31:09PM +1030, Qu Wenruo wrote: >> On 2023/12/20 20:24, Alexey Dobriyan wrote: >>>> Just as mentioned in the comment of memparse(), the simple_stroull() >>>> usage can lead to overflow all by itself. >>> >>> which is the root cause... >>> >>> I don't like one char suffixes. They are easy to integrate but then th= e >>> _real_ suffixes are "MiB", "GiB", etc. >>> >>> If you care only about memparse(), then using _parse_integer() can be >>> arranged. I don't see why not. >> >> Well, personally speaking I don't think we should even support the suff= ix at >> all, at least for the only two usage inside btrfs. >> >> But unfortunately I'm not the one to do the final call, and the final c= all >> is to keep the suffix behavior... >> >> And indeed using _parse_integer() with _parse_interger_fixup_radix() wo= uld >> be better, as we don't need to extend the _kstrtoull() code base. > > My comment on the first patch got vanished due to my MTA issues, but I'l= l try > to summarize my point here. > > First of all, I do not like the naming, it's too vague. What kind of suf= fix? > Do we suppose to have suffix in the input? What will be the behaviour w/= o > suffix? And so on... I really like David Sterb to hear this though. To me, we should mark memparse() as deprecated as soon as possible, not spreading the damn pandemic to any newer code. The "convenience" is not an excuse to use incorrect code. > > Second, if it's a problem in memparse(), just fix it and that's all. Nope, the memparse() itself doesn't have any way to indicate errors. It's not fixable in the first place, as long as you want a drop-in solutio= n. > > Third, as Alexey said, we have metric and byte suffixes and they are dif= ferent. > Supporting one without the other is just adding to the existing confusio= n. > > Last, but not least, we do NOT accept new code in the lib/ without test = cases. > > So, that said here is my formal NAK for this series (at least in this fo= rm). Then why there is the hell of memparse() in the first place? It doesn't have test case (we have cmdline_kunit, but it doesn't test memparse() at all), nor the proper error detection. I'm fine to get my patch rejected, but why the hell of memparse() is here in the first place? It doesn't fit any of the standard you mentioned. Thanks, Qu > > P.S> The Subject should start with either kstrtox: or lib/kstrtox.c. >