Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp111930iof; Sun, 5 Jun 2022 22:44:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwEA/Bdq54Xo5uNXDw9/V/zYADoHKxc3MrYuZrETWy1TrBRLu81cBhPJU1mVCgETj0vc/Y X-Received: by 2002:a17:902:e748:b0:164:1b1e:28fe with SMTP id p8-20020a170902e74800b001641b1e28femr23089928plf.116.1654494287312; Sun, 05 Jun 2022 22:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654494287; cv=none; d=google.com; s=arc-20160816; b=uakRxH9Grr2NWoa/DPQ+Urjn3X4lpED9h6gJ6c0vQ0cwYcFkH+pKECbYPPxkrE0r2p bKwZS+Zh0UC8OGiXDLFFAgj+dlX78bGuAp7kWUut+SDo/4tN5RFKCy/WUrzkGnJT3MYm LsTiykaviMsdXPqnI9c3qMcNFck43Ku4smHU6KCSi34mjGVnBd/Pb70fMblCarin0iSy 1/7EkLeA7tixZlgbRWUqFfzZpZfffwVFWjhVXEZa3Bh2mu6BkGG9SKnhDw1iLCtHjs03 KwW30oOzWHya2nm1CCF0D0J47RjqYCdm30iMm1NPr59QfZuOH7/rCJ022eXUEnml/jEJ YpAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=QPEZSRJ990pi2RCSDlHF+XduabkJPXy/1fR/WxsmxjU=; b=r5HPCXj0qDhowpbzZIDCArOLdfADRtSElRodTbSZLMvLOjusDMF7UcOnZc7Qp+488e JKvKNrbJaD0qANIi+Uzjvk77+DpKBdL+V4+/NFgbPBY+aOtIlizG4Q9VdXnZ8FpOh3B9 HoRP9OUZ6aXgCxYo9tqT9R1CARMJxh0D3J8bqFZKc/XJbN70ATmNk2HtOe5E3dUIGSKu OrAzuw6Sfw9nx3zPKuxj+rDvYgSBVtlnVzFW7U3deX3WVoFfA7+wodbQHhxf8XCU0hB1 rd7FZ4D+8fbR1D7U1mORz7kjiT9nWX/aolxuAmx+U7TeEYFJv/KhewUoD9zdQowqLIga 4p5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j62-20020a638b41000000b003daf5a335bcsi19897081pge.12.2022.06.05.22.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D581022CED6; Sun, 5 Jun 2022 21:35:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243571AbiFET6p (ORCPT + 99 others); Sun, 5 Jun 2022 15:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347198AbiFET6n (ORCPT ); Sun, 5 Jun 2022 15:58:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C0E4A3D3 for ; Sun, 5 Jun 2022 12:58:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE5196118D for ; Sun, 5 Jun 2022 19:58:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EA01C385A5 for ; Sun, 5 Jun 2022 19:58:39 +0000 (UTC) Subject: [PATCH v1 3/5] SUNRPC: Clean up xdr_commit_encode() From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Sun, 05 Jun 2022 15:58:38 -0400 Message-ID: <165445911819.1664.8436212544546306528.stgit@bazille.1015granger.net> In-Reply-To: <165445865736.1664.4497130284832282034.stgit@bazille.1015granger.net> References: <165445865736.1664.4497130284832282034.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-nfs@vger.kernel.org Both the ::iov_len field and the third parameter of memcpy() and memmove() are size_t. There's no reason for the implicit conversion from size_t to int and back. Change the type of @shift to make the code easier to read and understand. Signed-off-by: Chuck Lever --- net/sunrpc/xdr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 08a85375b311..de8f71468637 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -933,14 +933,16 @@ EXPORT_SYMBOL_GPL(xdr_init_encode); */ inline void xdr_commit_encode(struct xdr_stream *xdr) { - int shift = xdr->scratch.iov_len; + size_t shift = xdr->scratch.iov_len; void *page; if (shift == 0) return; + page = page_address(*xdr->page_ptr); memcpy(xdr->scratch.iov_base, page, shift); memmove(page, page + shift, (void *)xdr->p - page); + xdr_reset_scratch_buffer(xdr); } EXPORT_SYMBOL_GPL(xdr_commit_encode);