linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhen Lei <thunder.leizhen@huawei.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 2/2] pipe: delete a duplicate line of code in pipe_write()
Date: Mon, 15 Nov 2021 11:57:21 +0800	[thread overview]
Message-ID: <20211115035721.1909-3-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20211115035721.1909-1-thunder.leizhen@huawei.com>

The buf->offset has been assigned to 0 before the copy operation, and it
seems odd to readjust its value after the copy is complete. Delete the
second 'buf->offset = 0'.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 fs/pipe.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/pipe.c b/fs/pipe.c
index 302f1e50ce3be1d..7ba11a633c0eeb9 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -536,7 +536,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
 				break;
 			}
 			ret += copied;
-			buf->offset = 0;
 			buf->len = copied;
 
 			if (!iov_iter_count(from))
-- 
2.26.0.106.g9fadedd


      parent reply	other threads:[~2021-11-15  3:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  3:57 [PATCH 0/2] pipe: Fix a potential UAF and delete a duplicate line of code Zhen Lei
2021-11-15  3:57 ` [PATCH 1/2] pipe: fix potential use-after-free in pipe_read() Zhen Lei
2021-11-15  4:25   ` Matthew Wilcox
2021-11-15  6:13     ` Leizhen (ThunderTown)
2021-11-15 13:05       ` Matthew Wilcox
2021-11-23  1:09         ` Leizhen (ThunderTown)
2021-11-15  3:57 ` Zhen Lei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211115035721.1909-3-thunder.leizhen@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).