io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] io_uring: set @poll->file after @poll init
Date: Sun, 21 Jun 2020 13:09:52 +0300	[thread overview]
Message-ID: <663d6d6c6f3d1c8ddde158f7c171d3a2034c5453.1592733956.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1592733956.git.asml.silence@gmail.com>

It's a good practice to modify fields of a struct after but not before
it was initialised. Even though io_init_poll_iocb() doesn't touch
poll->file, call it first.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 84b39109bc30..676911260f60 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4585,8 +4585,8 @@ static __poll_t __io_arm_poll_handler(struct io_kiocb *req,
 	struct io_ring_ctx *ctx = req->ctx;
 	bool cancel = false;
 
-	poll->file = req->file;
 	io_init_poll_iocb(poll, mask, wake_func);
+	poll->file = req->file;
 	poll->wait.private = req;
 
 	ipt->pt._key = mask;
-- 
2.24.0


  parent reply	other threads:[~2020-06-21 10:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-21 10:09 [PATCH 0/4] small random patches Pavel Begunkov
2020-06-21 10:09 ` [PATCH 1/4] io_uring: remove setting REQ_F_MUST_PUNT in rw Pavel Begunkov
2020-06-21 10:09 ` [PATCH 2/4] io_uring: remove REQ_F_MUST_PUNT Pavel Begunkov
2020-06-21 10:09 ` Pavel Begunkov [this message]
2020-06-21 10:09 ` [PATCH 4/4] io_uring: kill NULL checks for submit state Pavel Begunkov
2020-06-22  3:06 ` [PATCH 0/4] small random patches Jens Axboe

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=663d6d6c6f3d1c8ddde158f7c171d3a2034c5453.1592733956.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).