Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2381299rwi; Fri, 28 Oct 2022 06:31:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bUA/4tuuMI1OxGYbBjYNWxcRH21jfAzn+7nORPQEbm5zBdAVxnkTaJSLEnWUWGOF8jd4C X-Received: by 2002:a17:907:86a8:b0:7ad:988e:a93 with SMTP id qa40-20020a17090786a800b007ad988e0a93mr4813294ejc.704.1666963864680; Fri, 28 Oct 2022 06:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666963864; cv=none; d=google.com; s=arc-20160816; b=ojKbDNsq4EZ428HV5gY1jhblIhY457BJEtHXM1hztqO1Kn1WU4RHg2iEJz+VVpYpC+ dadThwG/OHuuVQTGmYJcqTxor1r9VNrMeBDD2S4cVVLmIXOMI9nmM0ArQzSt45X9H69G /Bzt+tPIEM934i1YJPaejDdkPpyTJMuWQCQyP3Wesnt9f4e6NBOkBfctGOfkqR8C+VtF aYHaGAE73XBMYxiEmpIEBQBswuedEoOp9XsPpsXiJbQq2ECv350GSUaEigitTLUaBbJu nEnDDSGOyodo8Uq1fF7CZv3J11yK+wqQptOB+DhW2CwLplSVCPmVbqAdO8EqkMhj60LS LSGg== 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; bh=btfxey5mDYh8RdHRQ8iRoEemumWgnDRci38/KQJdhUI=; b=M6kPr5U2FL/M4akZySm/s+H6WcWxtDQtlR6k8Ur5+Qj4rK7pptrymrw0Of7cDSoNJE HVPgEflHY8p6z+WXHKO2jD4JijwTzd89qpPpJA5CiA/bghvRvu+DcppXz7MimwjDiay/ TmjROfVg2+8JWGwjPx8xU6Km70jpUY0mlT/gbkA24X3bo6rzUA9jT0lUJ9XxHJquxIt6 eJYaqnPVktOVAcBcjAwruFOYkN2lXeUuBx6MgPPqyzHJDaeFke8BdLqZCUnApH93stkm v0YswYck+U/f250hLaX/rf31iZ+NFcdogAlKMI50C1WGZuv8EzcZpwGkShRQCfMlD+fO OMqA== 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 z16-20020a50cd10000000b00459c1e64776si2483314edi.412.2022.10.28.06.30.38; Fri, 28 Oct 2022 06:31:04 -0700 (PDT) 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 S229964AbiJ1Ms1 (ORCPT + 99 others); Fri, 28 Oct 2022 08:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiJ1MsZ (ORCPT ); Fri, 28 Oct 2022 08:48:25 -0400 Received: from mail.stoffel.org (mail.stoffel.org [172.104.24.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F236068E; Fri, 28 Oct 2022 05:48:24 -0700 (PDT) Received: from quad.stoffel.org (068-116-170-226.res.spectrum.com [68.116.170.226]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.stoffel.org (Postfix) with ESMTPSA id 758DE29C47; Fri, 28 Oct 2022 08:48:23 -0400 (EDT) Received: by quad.stoffel.org (Postfix, from userid 1000) id AC28FA8004; Fri, 28 Oct 2022 08:48:22 -0400 (EDT) Date: Fri, 28 Oct 2022 08:48:22 -0400 From: John Stoffel To: Al Viro Cc: Christoph Hellwig , David Howells , willy@infradead.org, dchinner@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , Ira Weiny , torvalds@linux-foundation.org, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 10/12] [xen] fix "direction" argument of iov_iter_kvec() Message-ID: References: <20221028023352.3532080-1-viro@zeniv.linux.org.uk> <20221028023352.3532080-10-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221028023352.3532080-10-viro@zeniv.linux.org.uk> X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_ADSP_NXDOMAIN, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS 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-kernel@vger.kernel.org On Fri, Oct 28, 2022 at 03:33:50AM +0100, Al Viro wrote: > Signed-off-by: Al Viro > --- > drivers/xen/pvcalls-back.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c > index d6f945fd4147..21b9c850a382 100644 > --- a/drivers/xen/pvcalls-back.c > +++ b/drivers/xen/pvcalls-back.c > @@ -129,13 +129,13 @@ static bool pvcalls_conn_back_read(void *opaque) > if (masked_prod < masked_cons) { > vec[0].iov_base = data->in + masked_prod; > vec[0].iov_len = wanted; > - iov_iter_kvec(&msg.msg_iter, WRITE, vec, 1, wanted); > + iov_iter_kvec(&msg.msg_iter, READ, vec, 1, wanted); Wouldn't it make more sense to use READER and WRITER here, since the current READ/WRITE are 100% non-obvious? This is probably a bigger change, but this just looks wrong and will be so easy for people to screw up again and again down the line. > } else { > vec[0].iov_base = data->in + masked_prod; > vec[0].iov_len = array_size - masked_prod; > vec[1].iov_base = data->in; > vec[1].iov_len = wanted - vec[0].iov_len; > - iov_iter_kvec(&msg.msg_iter, WRITE, vec, 2, wanted); > + iov_iter_kvec(&msg.msg_iter, READ, vec, 2, wanted); > } > > atomic_set(&map->read, 0); > @@ -188,13 +188,13 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map) > if (pvcalls_mask(prod, array_size) > pvcalls_mask(cons, array_size)) { > vec[0].iov_base = data->out + pvcalls_mask(cons, array_size); > vec[0].iov_len = size; > - iov_iter_kvec(&msg.msg_iter, READ, vec, 1, size); > + iov_iter_kvec(&msg.msg_iter, WRITE, vec, 1, size); > } else { > vec[0].iov_base = data->out + pvcalls_mask(cons, array_size); > vec[0].iov_len = array_size - pvcalls_mask(cons, array_size); > vec[1].iov_base = data->out; > vec[1].iov_len = size - vec[0].iov_len; > - iov_iter_kvec(&msg.msg_iter, READ, vec, 2, size); > + iov_iter_kvec(&msg.msg_iter, WRITE, vec, 2, size); > } > > atomic_set(&map->write, 0); > -- > 2.30.2 > --