Skip to content

Commit 9f3a2cb

Browse files
isilenceaxboe
authored andcommitted
io_uring: kill extra checks in io_write()
We don't retry short writes and so we would never get to async setup in io_write() in that case. Thus ret2 > 0 is always false and iov_iter_advance() is never used. Apparently, the same is found by Coverity, which complains on the code. Fixes: cd65869 ("io_uring: use iov_iter state save/restore helpers") Reported-by: Dave Jones <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/5b33e61034748ef1022766efc0fb8854cfcf749c.1632500058.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent cdb31c2 commit 9f3a2cb

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

fs/io_uring.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,7 +3605,6 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
36053605
iov_iter_save_state(iter, state);
36063606
}
36073607
req->result = iov_iter_count(iter);
3608-
ret2 = 0;
36093608

36103609
/* Ensure we clear previously set non-block flag */
36113610
if (!force_nonblock)
@@ -3670,8 +3669,6 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
36703669
} else {
36713670
copy_iov:
36723671
iov_iter_restore(iter, state);
3673-
if (ret2 > 0)
3674-
iov_iter_advance(iter, ret2);
36753672
ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
36763673
return ret ?: -EAGAIN;
36773674
}

0 commit comments

Comments
 (0)