From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 2/7] io_uring: remove extra checks in send/recv
Date: Thu, 16 Jul 2020 23:28:00 +0300 [thread overview]
Message-ID: <239b75b2614ef48f3e292e725fe617de46e9145d.1594930020.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
With the return on a bad socket, kmsg is always non-null by the end
of the function, prune left extra checks and initialisations.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ae857e16aa6d..3d5c7f3feec4 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3919,7 +3919,7 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
static int io_sendmsg(struct io_kiocb *req, bool force_nonblock,
struct io_comp_state *cs)
{
- struct io_async_msghdr iomsg, *kmsg = NULL;
+ struct io_async_msghdr iomsg, *kmsg;
struct socket *sock;
unsigned flags;
int ret;
@@ -3954,7 +3954,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock,
if (ret == -ERESTARTSYS)
ret = -EINTR;
- if (kmsg && kmsg->iov != kmsg->fast_iov)
+ if (kmsg->iov != kmsg->fast_iov)
kfree(kmsg->iov);
req->flags &= ~REQ_F_NEED_CLEANUP;
if (ret < 0)
@@ -4150,7 +4150,7 @@ static int io_recvmsg_prep(struct io_kiocb *req,
static int io_recvmsg(struct io_kiocb *req, bool force_nonblock,
struct io_comp_state *cs)
{
- struct io_async_msghdr iomsg, *kmsg = NULL;
+ struct io_async_msghdr iomsg, *kmsg;
struct socket *sock;
struct io_buffer *kbuf;
unsigned flags;
@@ -4202,7 +4202,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock,
if (kbuf)
kfree(kbuf);
- if (kmsg && kmsg->iov != kmsg->fast_iov)
+ if (kmsg->iov != kmsg->fast_iov)
kfree(kmsg->iov);
req->flags &= ~REQ_F_NEED_CLEANUP;
@@ -4215,7 +4215,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock,
static int io_recv(struct io_kiocb *req, bool force_nonblock,
struct io_comp_state *cs)
{
- struct io_buffer *kbuf = NULL;
+ struct io_buffer *kbuf;
struct io_sr_msg *sr = &req->sr_msg;
struct msghdr msg;
void __user *buf = sr->buf;
--
2.24.0
next prev parent reply other threads:[~2020-07-16 20:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 20:27 [PATCH 5.9 0/7] recv/rw select-buffer fortifying Pavel Begunkov
2020-07-16 20:27 ` [PATCH 1/7] io_uring: indent left {send,recv}[msg]() Pavel Begunkov
2020-07-16 20:28 ` Pavel Begunkov [this message]
2020-07-16 20:28 ` [PATCH 3/7] io_uring: don't forget cflags in io_recv() Pavel Begunkov
2020-07-16 20:28 ` [PATCH 4/7] io_uring: free selected-bufs if error'ed Pavel Begunkov
2020-07-16 20:28 ` [PATCH 5/7] io_uring: move BUFFER_SELECT check into *recv[msg] Pavel Begunkov
2020-07-16 20:28 ` [PATCH 6/7] io_uring: extract io_put_kbuf() helper Pavel Begunkov
2020-07-16 20:28 ` [PATCH 7/7] io_uring: don't open-code recv kbuf managment Pavel Begunkov
2020-07-16 21:13 ` [PATCH 5.9 0/7] recv/rw select-buffer fortifying Jens Axboe
2020-07-16 21:14 ` Pavel Begunkov
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=239b75b2614ef48f3e292e725fe617de46e9145d.1594930020.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/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