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: cd65869512
("io_uring: use iov_iter state save/restore helpers")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5b33e61034748ef1022766efc0fb8854cfcf749c.1632500058.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
cdb31c29d3
commit
9f3a2cb228
@ -3605,7 +3605,6 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
iov_iter_save_state(iter, state);
|
iov_iter_save_state(iter, state);
|
||||||
}
|
}
|
||||||
req->result = iov_iter_count(iter);
|
req->result = iov_iter_count(iter);
|
||||||
ret2 = 0;
|
|
||||||
|
|
||||||
/* Ensure we clear previously set non-block flag */
|
/* Ensure we clear previously set non-block flag */
|
||||||
if (!force_nonblock)
|
if (!force_nonblock)
|
||||||
@ -3670,8 +3669,6 @@ done:
|
|||||||
} else {
|
} else {
|
||||||
copy_iov:
|
copy_iov:
|
||||||
iov_iter_restore(iter, state);
|
iov_iter_restore(iter, state);
|
||||||
if (ret2 > 0)
|
|
||||||
iov_iter_advance(iter, ret2);
|
|
||||||
ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
|
ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
|
||||||
return ret ?: -EAGAIN;
|
return ret ?: -EAGAIN;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user