Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1730735pxb; Thu, 16 Sep 2021 14:11:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeyARs6MoE5RHDLq89xp6mJ+mPDhvJSouZz651peOPaVPcl9thODcxTChIWv5YbdgyBb/r X-Received: by 2002:a92:c683:: with SMTP id o3mr5685875ilg.0.1631826718911; Thu, 16 Sep 2021 14:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631826718; cv=none; d=google.com; s=arc-20160816; b=ikwbFn4Y2+o82+2sSKMqBnoVtCoE12NPNNSsX8yNlp/v+VC2OKxGoLQYFDIBrL0nZR HbDVWDR1GvJWmSHxB00npJvb4b/atWP1BkDrTgFXYpexdgQ3P4BMsPAYfg3Nw5YlCaU2 CfUU8W59aiU0XmTNTl/i/RWh9svYn7blLWAOJFRyfCqS7FveXG2v/g7PC+8nRkvUHMY9 xyCiVV9l4+zMBL1MZksgaBpvPj66SJ/pDHyO0Efz3ADFFIwJEN07tSkZz6XKiMUdSBqN tjPCzfyIZacmnBfw5rp2uIxGZ+LQbxguFv22G0L8PDK2609DNS8yqLIvVQBs3/Fm/Yku AYQQ== 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:subject:cc:to :from:dkim-signature; bh=X9eFiuPrAdSZNeJ04115Ml+9zPOtiM0Jfnl5U5hPCDw=; b=lJusXPGxpYWIBf7pkD4Kr+/aBwN4Ln4zAlK/Hqn8hH0uS0zwhl0UBTJ9lhseOhS7iR c4dAODk1Ch1AMul+nOKFR9nnq3UChkHiK5RwrgbUmPVzAdpY10cdaO1psu7mYfzN5XM5 zS0bwnczANmT/kIiZtzoLn5urffW1vnF1vNq1k62rEwRB1THRuBdjFU8XCUeUc7ks7m4 H6avdbH7RIG7IzRWMldFbI34Q1Pws+PNAojg4zOqSd94+Yuflkn7TXJ3h2UYtLiqgdog oJKN4E3VJOcS6KN7RR4i4HjOrhA7PufqqmkKv5r31l5sezcQSYDHvWnlC4XieKTBpPj+ a0GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gigv3N6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si3431101iol.46.2021.09.16.14.11.47; Thu, 16 Sep 2021 14:11:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gigv3N6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243989AbhIPQef (ORCPT + 99 others); Thu, 16 Sep 2021 12:34:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:36998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240942AbhIPQ0v (ORCPT ); Thu, 16 Sep 2021 12:26:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3ED526152A; Thu, 16 Sep 2021 16:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809036; bh=1ztJ4vTn+M9k7NbaV/SF2yxHhIUd78+fIQxAk7eg9JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gigv3N6Zrc2xGmjYrvLLn2mCdrMBVEzSAb883mwCSldu2ulnJ/Q4242B+QWbyjK/r ONUn9IyzeIQhm04DzCJfgvyj5MvWq1iUqMI6eJozy7dEfJtdCaQMkDrXXFoNOgcLUz zsdkjJZBXBEf6UhUJamTHy4FapZtj2e/Ixov3ztU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 279/306] io_uring: remove duplicated io_size from rw Date: Thu, 16 Sep 2021 18:00:24 +0200 Message-Id: <20210916155803.589764820@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov [ Upstream commit 632546c4b5a4dad8e3ac456406c65c0db9a0b570 ] io_size and iov_count in io_read() and io_write() hold the same value, kill the last one. Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/io_uring.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 8de0f52fd29d..d0089039fee7 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3413,7 +3413,6 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, struct iov_iter __iter, *iter = &__iter; struct io_async_rw *rw = req->async_data; ssize_t io_size, ret, ret2; - size_t iov_count; bool no_async; if (rw) @@ -3422,8 +3421,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock); if (ret < 0) return ret; - iov_count = iov_iter_count(iter); - io_size = iov_count; + io_size = iov_iter_count(iter); req->result = io_size; ret = 0; @@ -3439,7 +3437,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, if (no_async) goto copy_iov; - ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count); + ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), io_size); if (unlikely(ret)) goto out_free; @@ -3458,7 +3456,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, if (req->file->f_flags & O_NONBLOCK) goto done; /* some cases will consume bytes even on error returns */ - iov_iter_revert(iter, iov_count - iov_iter_count(iter)); + iov_iter_revert(iter, io_size - iov_iter_count(iter)); ret = 0; goto copy_iov; } else if (ret < 0) { @@ -3542,7 +3540,6 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, struct kiocb *kiocb = &req->rw.kiocb; struct iov_iter __iter, *iter = &__iter; struct io_async_rw *rw = req->async_data; - size_t iov_count; ssize_t ret, ret2, io_size; if (rw) @@ -3551,8 +3548,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock); if (ret < 0) return ret; - iov_count = iov_iter_count(iter); - io_size = iov_count; + io_size = iov_iter_count(iter); req->result = io_size; /* Ensure we clear previously set non-block flag */ @@ -3570,7 +3566,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, (req->flags & REQ_F_ISREG)) goto copy_iov; - ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), iov_count); + ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), io_size); if (unlikely(ret)) goto out_free; @@ -3613,7 +3609,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, } else { copy_iov: /* some cases will consume bytes even on error returns */ - iov_iter_revert(iter, iov_count - iov_iter_count(iter)); + iov_iter_revert(iter, io_size - iov_iter_count(iter)); ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); if (!ret) return -EAGAIN; -- 2.30.2