Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1187177iof; Mon, 6 Jun 2022 23:44:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8vPlECWizGxaLWqCA6FepipRDnqnKZZoI81TFYKmGx+h4tvusVhUd2inJcRcW0OIqgf+V X-Received: by 2002:a05:6402:750:b0:42d:a765:8637 with SMTP id p16-20020a056402075000b0042da7658637mr31336871edy.342.1654584240324; Mon, 06 Jun 2022 23:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654584240; cv=none; d=google.com; s=arc-20160816; b=dXSdx1wZMOCr2cWuamBHVv0ptRGRba5TZDBbAzz5PEDAEA03RGgqCPTUxB3xGbt2io QJcKW9X1NiLIgVyPZD5XdhiywZr9kLPuPhjF+20ZI4lfk0gn1v+F7wmf+c5xFec2AS8n ImFk3rM9dRFjZ6BecxR3oRi/mhRcAbUpDkvBxHcjAvFdMA6DRYw4CmQ3yCNAYHZk9Hpm J8kaBzMuxsmb/DdqFEQK+NPj8WGs8O44BU4rVamNGI4JawMaQpxNM7reAcISan8+gUrp VGgR2sSjTC6HjgCcT9nbhBJ7TRmzm5mtbCrSn9iL72l6c8NLeMaHWsQohvhwnxivNh2W bHQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=n3TuOM+703DKMqP6jLJL2VhZSBSLY8652zR/b4ZaytM=; b=UUGH6VfxBjYjd0grSGqilNfJ8nJ6p9D+st+XR+cVz8nUUfF24ZDRvpp/1uCWrZDEC0 HTCZuydvArQGrFaLpU3h1JSSTvnIkCcJVacsxEQjE1oDHBqtOmWGmkJWsh31AnvnSIHi rxqtuwnrZiQjyVDj9ehblYxlfVTqkic6XGKpEFil/fF+jbYtIOJIBuj9NUle5JCoY7k7 FlLl/QhedKEY/x2mG1h7pBlCXRMo4Ch6CnDZsYzyeHhbqXBW6o9ujw15AlUWCekvv0mV klLMxgwFSw01todQCtfHWM+6lXf1Vx50Hmt4EGnWvUOnckcY6MWEqcWGuEEufTuVK13u VyOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DMOtuOGe; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a170906161800b0070434ac836esi16425789ejd.468.2022.06.06.23.43.33; Mon, 06 Jun 2022 23:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@suse.de header.s=susede2_rsa header.b=DMOtuOGe; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbiFGBFz (ORCPT + 99 others); Mon, 6 Jun 2022 21:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232513AbiFGBFy (ORCPT ); Mon, 6 Jun 2022 21:05:54 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77BC06AA4D for ; Mon, 6 Jun 2022 18:05:53 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 364B61FAE3; Tue, 7 Jun 2022 01:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1654563952; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n3TuOM+703DKMqP6jLJL2VhZSBSLY8652zR/b4ZaytM=; b=DMOtuOGeqileWBbj6OMWiKQzaW2xsWVbH48o7iq+HtqINVolBGzdaTOv86EWAnL256JK1I hvn9Kf6nZ1/DqIDWluTLvSrlsJDNZmASzxOxqppTJhYLdwUceZjfXfcyMxG+LPI9tC6lx/ c0SroRcvPvX+yyloqSHwSb2pPNp9LFc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1654563952; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n3TuOM+703DKMqP6jLJL2VhZSBSLY8652zR/b4ZaytM=; b=dL763/Z7yZOF0z0M6/XpTrReTYg12gzQXEp4jOGyM1ieuLbHW9CjFvRvWwwpn2QLdn/1k1 xdtOqfTHbNrkPWAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5D68A13A5F; Tue, 7 Jun 2022 01:05:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3I+LBm+knmKEFQAAMHmgww (envelope-from ); Tue, 07 Jun 2022 01:05:51 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Chuck Lever" Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v1 3/5] SUNRPC: Clean up xdr_commit_encode() In-reply-to: <165445911819.1664.8436212544546306528.stgit@bazille.1015granger.net> References: <165445865736.1664.4497130284832282034.stgit@bazille.1015granger.net>, <165445911819.1664.8436212544546306528.stgit@bazille.1015granger.net> Date: Tue, 07 Jun 2022 11:05:48 +1000 Message-id: <165456394819.22243.15333379326870400835@noble.neil.brown.name> 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_PASS,T_SCC_BODY_TEXT_LINE 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-nfs@vger.kernel.org On Mon, 06 Jun 2022, Chuck Lever wrote: > 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. I wouldn't object to "shift" being renamed "frag1bytes" to make the connection with xdr_get_next_encode_buffer() more blatant.. Reviewed-by: NeilBrown Thanks, NeilBrown > > 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); > > >