summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-07-16 23:28:00 +0300
committerJens Axboe <axboe@kernel.dk>2020-07-24 13:00:45 -0600
commit6b754c8b912a164fbb15b7b839d51709c3d9ee6f (patch)
tree9974c4940f0f00bfee24f609848ee79a16827d4a /fs/io_uring.c
parent7a7cacba8b4560403615b04d57bdcd1f93f90f10 (diff)
downloadlwn-6b754c8b912a164fbb15b7b839d51709c3d9ee6f.tar.gz
lwn-6b754c8b912a164fbb15b7b839d51709c3d9ee6f.zip
io_uring: remove extra checks in send/recv
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 <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 264b1e5e2d54..ac3c16ea7d23 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3916,7 +3916,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;
@@ -3951,7 +3951,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)
@@ -4147,7 +4147,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;
@@ -4199,7 +4199,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;
@@ -4212,7 +4212,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;