Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp586633rwb; Thu, 1 Dec 2022 06:07:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZPh7DpHp0l2N5gcCdOSv1x8KgBEAn2cAWanGSns+/YFC3QmM8P8hrdntYfw/h4meOuv3K X-Received: by 2002:a17:903:1015:b0:189:854e:93b1 with SMTP id a21-20020a170903101500b00189854e93b1mr22503981plb.117.1669903623206; Thu, 01 Dec 2022 06:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669903623; cv=none; d=google.com; s=arc-20160816; b=dyjQVrQ5cwOH9tAj/hsP4KmstMBleldsc8fFGUmi+4Bq6ymQPG2hkdTht2RbVeF/D3 dCd3p2B4sbQmIt70L7sziyXUD/IXFO+1TmE7WBCowm3GHbjEMwmsGLA49NJg6tZm428E W0A8TlS/0JtucVV8Vpyk5PCoPX7m0ydXw59tiIu+4YWB9yyPExYjhVdvHeYb+l10IZqX WfbOOVevKuZeXr/4W0hB0At526Im2RL+pOiLZDt/pCX4bZenJfxsRvKBY78mpaaa1A0P oMjrH3ifpvbMS08p2DnmronwINKPIN5Am+MI6ANPkNkPOQ9CMalJ7aq/KmlpYT1y4htY jd/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=eKwnuS1UL0pYmW1/tSq0AMfnpJUSePTdoktmd6jtc28=; b=rg4qbMXEc2gw9lk689VYTBI6+D+sIio1mMh/ZQsxOuopi/0SiCC5tEkE+ky5B0pZPX bZmevs3veJHeE7BLRpB+VoLJclSmlUuJGKG2NdFH0uP13jPmjQVp+91ANTeWCFwHqzeI +7NGWfAXAiz78ApHoKAT284U8fLUG80s1F0X2XT9VR+atPyVvYlqk6cPeiMWvPx5KeAb gLnB4Eoo8fY02va40N8xyQdk4V+kyxvbz/o+cnSrpxCWXJUr8L3jt4XOfKdVfVZNYIvR bEZBpLaeoF0pnT4bEPTrUOmDrs3GgH/+uCpwoWL5LVeNMeQcOmZmGv/Sb8urtyWZk8fN TUGw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v189-20020a6389c6000000b004785d1fa646si4422615pgd.269.2022.12.01.06.06.48; Thu, 01 Dec 2022 06:07:03 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231639AbiLANrr (ORCPT + 82 others); Thu, 1 Dec 2022 08:47:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229521AbiLANrn (ORCPT ); Thu, 1 Dec 2022 08:47:43 -0500 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED85DFDD; Thu, 1 Dec 2022 05:47:39 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4NNHSk1jxsz4f3jHR; Thu, 1 Dec 2022 21:47:34 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP2 (Coremail) with SMTP id Syh0CgB3jrl4sIhjHtzRBQ--.20446S3; Thu, 01 Dec 2022 21:47:36 +0800 (CST) Subject: Re: [PATCH -next v2 2/9] blk-iocost: improve hanlder of match_u64() To: Tejun Heo , Yu Kuai Cc: Li Nan , josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, "yukuai (C)" References: <20221130132156.2836184-1-linan122@huawei.com> <20221130132156.2836184-3-linan122@huawei.com> <7e4f1cea-2691-9b81-35f6-0dd236149f56@huaweicloud.com> From: Yu Kuai Message-ID: <46bd7f33-6f24-a7a0-6359-3dc9aad98e6f@huaweicloud.com> Date: Thu, 1 Dec 2022 21:47:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgB3jrl4sIhjHtzRBQ--.20446S3 X-Coremail-Antispam: 1UD129KBjvJXoW7WFW5GF1UCFW7ZrW7Ary7Wrg_yoW8Wr4DpF W3tas7Ar18Cr1Sk3W2y3y7XayYyr4xJr1YvFy5K348Zr1a9rW2yr17tw1Y93WUA397Kr1j qF4YvasxXw1DZa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9014x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kI c2xKxwCYjI0SjxkI62AI1cAE67vIY487MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4 AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE 17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMI IF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1U MIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIda VFxhVjvjDU0xZFpf9x0JUZa9-UUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi, 在 2022/12/01 18:08, Tejun Heo 写道: > On Thu, Dec 01, 2022 at 10:15:53AM +0800, Yu Kuai wrote: >> Hi, >> >> 在 2022/12/01 4:32, Tejun Heo 写道: >>> On Wed, Nov 30, 2022 at 09:21:49PM +0800, Li Nan wrote: >>>> From: Yu Kuai >>>> >>>> 1) There are one place that return value of match_u64() is not checked. >>>> 2) If match_u64() failed, return value is set to -EINVAL despite that >>>> there are other possible errnos. >>> >>> Ditto. Does this matter? >>> >> >> It's not a big deal, but I think at least return value of match_u64() >> should be checked, we don't want to continue with invalid input, right? > > Yeah, sure. > >> By the way, match_u64() can return -ERANGE, which can provide more >> specific error messge to user. > > I'm really not convinced going over 64bit range would be all that difficult > to spot whether the error code is -EINVAL or -ERANGE. There isn't anything > wrong with returning -ERANGE but the fact that that particular function > returns an error code doesn't necessarily mean that it *must* be forwarded. > > Imagine that we used sscanf(buf, "%llu", &value) to parse the number > instead. We'd only know whether the parsing would have succeeded or not and > would probably return -EINVAL on failure and the behavior would be just > fine. This does not matter *at all*. > > So, idk, I'm not necessarily against it but changing -EINVAL to -ERANGE is > pure churn. Nothing material is being improved by that change. Thanks for the review and explanation, I'll just keep the addition of return value checking of the former 2 patches. Thanks, Kuai