Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp86491rdb; Wed, 20 Dec 2023 07:02:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFrB9heosKrSvnXu83HxIqgyHXv8TkOxWtuFSRmZKCXpNXFV9icgmb8qHAg/QdCh7K/aBm X-Received: by 2002:a05:6a20:2593:b0:190:8c90:c317 with SMTP id k19-20020a056a20259300b001908c90c317mr23330517pzd.79.1703084532587; Wed, 20 Dec 2023 07:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703084532; cv=none; d=google.com; s=arc-20160816; b=Jjo3JjnYwAECEjhlgg8fs7J9La0Jo6SHcSUpGv84tKeErrCEtdFtzeCZyVZtXzer7X mkrXpOrs1gITNV+DUi8RpsIcZAqmShsSYLfBuKpUCBrHxmSi8WkL90X7UjhBCM6W0T9b sz2ATRbjLg6alm/0NyXgmdD5bAPj0qPx642PzTy2lWr0zKQ0hUq53YkEHP/gwGPuhPfB JThFOAMYbUUPUMXmGc0G+jXW+Qd4kukGrxjjpA5oQ0cXBX/rCOMP83swQdez5NXLglzd amVbRkAdgttjRnrUkZdj/Gx4dXlKDv8dspFJibv+SX0D4A6N5/gYhMpTyZXbeVmLeiq0 hYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:resent-to:resent-message-id :resent-date:resent-from:dkim-signature; bh=G7q6/uCCgkR/eyLpPzUCwzkrG1UBjcBpzdvAI37VKJE=; fh=+fIU1ytzUojl8NmxG2n8bwsTlVSxX62wnnBcjRwlG7E=; b=Ei9ZxmGgH+km2EAFhWPRr16CZfKFwLElkRjXmb8mi1UBSID8m7EgIdZZz2b3NJGp8E 0S210/u4q6IrCKNA2w+Fczc2L2PYjZjsW0n0I5yeNfOXvec/5S52E/C4SI/+mVmMrmzp ojFK5nAZHSR1OSrtjRcoy7FArQ0V9B0q5WsDgWGpynsAHSNbZNmJtOh1/hrr+vtoSOhh Q6UBRwIGOYmtdy6j53DEBhmXQdkz/Tz3wXvGCKRZOUgaAsxEsQ8KQIi647qfI4WCOn8A jYHvNdKRU2pv9DwyyH5QV3WZ60VUWm91NXKIAS0Aw3l7lVEno3hDiNAIQvsXW+NBMF2s kOVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Bcuvbqw7; spf=pass (google.com: domain of linux-kernel+bounces-7108-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w188-20020a6362c5000000b005cd8a601b2esi7108774pgb.469.2023.12.20.07.02.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 07:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7108-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=@intel.com header.s=Intel header.b=Bcuvbqw7; spf=pass (google.com: domain of linux-kernel+bounces-7108-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 3D884288C89 for ; Wed, 20 Dec 2023 15:01:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 135CC3FB21; Wed, 20 Dec 2023 14:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Bcuvbqw7" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 CA0C646427 for ; Wed, 20 Dec 2023 14:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703084392; x=1734620392; h=resent-from:resent-date:resent-message-id:resent-to:date: from:to:cc:subject:message-id:references:mime-version: in-reply-to; bh=dYVnPf9oHskhTHAwIlHPPxyaHADOhxmPpVIoHmI88Zw=; b=Bcuvbqw7LBMnErZDD5UOLEamYdWzgLVchqrIyIeqg4nqZ0VSwYru+EIt WmOks/8R0MfOph1ms4k8yGWzFNxOEk92mnVWiiV3H4HIzHRRygW4KIAjt WmMUNBf65a48fi9H13vIZzWPi+vwZXsEX2qXIBF/Y/2yggp4gEO2IlvLF q1uFs8nCkimLlXER16wFiUfjfFq+k7kyYuQw+d5UF72djxPIkpcKrXZJN EwTvkHw5YlIVQPcKCA5HaFikWdpZuIWKxqC/vcxHp2VceDseS5JecX1av NaVAGqnvlIAkVVpSN/kaodJANqUpDTB4QIDNmsZja0ls3T3lA4JOx58LH Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="375978487" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="375978487" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 06:59:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="805288083" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="805288083" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 06:59:50 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rFxwv-00000007Z63-3Z99; Wed, 20 Dec 2023 16:53:29 +0200 Resent-From: Andy Shevchenko Resent-Date: Wed, 20 Dec 2023 16:53:29 +0200 Resent-Message-ID: Resent-To: wqu@suse.com, adobriyan@gmail.com, akpm@linux-foundation.org, christophe.jaillet@wanadoo.fr, linux-kernel@vger.kernel.org Date: Wed, 20 Dec 2023 16:16:43 +0200 From: Andy Shevchenko To: Qu Wenruo Cc: Alexey Dobriyan , Andrew Morton , linux-btrfs@vger.kernel.org, Christophe JAILLET , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] lib/strtox: introduce kstrtoull_suffix() helper Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 the > > _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 suffix 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 call > is to keep the suffix behavior... > > And indeed using _parse_integer() with _parse_interger_fixup_radix() would > 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'll try to summarize my point here. First of all, I do not like the naming, it's too vague. What kind of suffix? Do we suppose to have suffix in the input? What will be the behaviour w/o suffix? And so on... Second, if it's a problem in memparse(), just fix it and that's all. Third, as Alexey said, we have metric and byte suffixes and they are different. Supporting one without the other is just adding to the existing confusion. 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 form). P.S> The Subject should start with either kstrtox: or lib/kstrtox.c. -- With Best Regards, Andy Shevchenko