Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2662933rwb; Wed, 30 Nov 2022 09:15:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eFybzriNXxIkyUgQ2rWd/F9m0o9XPnCKnN7t2gp+3zkFxPCM7jZhEwBsWmvaZZ/Vvd/EF X-Received: by 2002:a17:902:d58d:b0:17f:72a4:30a1 with SMTP id k13-20020a170902d58d00b0017f72a430a1mr46158335plh.124.1669828512914; Wed, 30 Nov 2022 09:15:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669828512; cv=none; d=google.com; s=arc-20160816; b=syXDINqCm7w1FQB520jkhysCnvArs5POhlay+m2dZglz4XSU+JG+/pUKmldV+xOD2c 1xhyQf0ev5KfOfqPokWXGI4G2l8m52WpmJKE/m1ap6XBKwyW8AmrFD74aGVpkIisTWnc mKR/vtTcGHFDxmlvQuE9tSuC5rfoJWtD1yCxBsRVGErP7Q6CRO8FNU4KRTR9far/1QMb uK8SGxFBpckmgxjYtu5vgLXyWA+ytPDwQ+xRBD3KcrgVIkgiv9Y72B8dI87FvGErgixe UO97Wt0QXeps5JII5ZmfBX9e2PwpX/prmtROchPZeDmMNc5oDVbqdn56dB7q0oOJCaTB IDEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rtn/WXCw0wV01K8XKJePt3vHFYfBvU4R/AXIM98Ihms=; b=WrhBd+UXmXaHd+YSx0KN5ji+ZOb89qMrAVO+IrqP/u7+TGkc14CPrbvM+g3S/veHiA rkL2AlcBeoi10j2KVkTZCqLT9cefCiypVNtiUNj341H35Q7yUqgtrJrRcOh0fZBmvU2p vE6/uAXPjGUhZ78Kb4HIs+u+VkMONxiy43rz6CGagNmoQtkGOkQhCb5nEkfqjcNg7Oi5 ZO9/GF1K+dPC2Luj7xc9i6/aHuYjKwFnu239xP1NV04iXlJ6eiUPWn53nuLWF5xtn7L+ cbZVt/0dkHT8GsI/w1Oq2Fxyyd3SewdK14QIMyhCT22AuuJOGpyd3QQN+M5YXBrzUu7G d5cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yy2TohvP; 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 pc3-20020a17090b3b8300b0021965b11ab9si2087396pjb.99.2022.11.30.09.15.01; Wed, 30 Nov 2022 09:15:12 -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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=yy2TohvP; 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 S230046AbiK3P4G (ORCPT + 83 others); Wed, 30 Nov 2022 10:56:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiK3Pzv (ORCPT ); Wed, 30 Nov 2022 10:55:51 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0830D81D9E; Wed, 30 Nov 2022 07:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rtn/WXCw0wV01K8XKJePt3vHFYfBvU4R/AXIM98Ihms=; b=yy2TohvPNBWn7ruaJrvJfv1ER8 c0+MmIgJ9iTduM3PrmJ7tMWyiH2RLQ9ghj0MuDl4zW86cCDoGwPfQn0XN1E4DPKfdWef28YgT5B2o TcYI4KPhL24HRpqiqLrMfPtKoqZqu/izKuxYY+3SwBwfHxZNGnwDLczaDg3epW0Trs61x/pHosxWF m524O23xHwHZt0xA+IqftNKK0n1BWYd6m2RIr9AIpXfOZ+kOvOw/FABKYSPtxNq+uy4TXAsg2hFs4 z17t24bY4u6mCpQrHQJeJyQLf8ygi9YlMtaPrqLqpV44Z5flNOXgXwNU1rWBgzRppEyRhfFL7h5m1 ap77dYLg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0PR4-000ANP-2U; Wed, 30 Nov 2022 15:55:46 +0000 Date: Wed, 30 Nov 2022 07:55:46 -0800 From: Christoph Hellwig To: Li Nan Cc: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com Subject: Re: [PATCH -next v2 1/9] blk-iocost: cleanup ioc_qos_write() and ioc_cost_model_write() Message-ID: References: <20221130132156.2836184-1-linan122@huawei.com> <20221130132156.2836184-2-linan122@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Wed, Nov 30, 2022 at 07:54:59AM -0800, Christoph Hellwig wrote: > > + ret = nbytes; > > ret is an int which bytes is a size_t. So we at least need a ssize_t > instead for ret, and even that assumes nbytes never overflows a ssize_t. A better way might be to initialize ret to 0 at declaration time and then do if (ret) return ret; return nbytes;