Commit f261c168 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: comment on kfree(iovec) checks

kfree() handles NULL pointers well, but io_{read,write}() checks it
because of performance reasons. Leave a comment there for those who are
tempted to patch it.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bb175342
...@@ -3204,6 +3204,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, ...@@ -3204,6 +3204,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
kiocb_done(kiocb, ret, cs); kiocb_done(kiocb, ret, cs);
ret = 0; ret = 0;
out_free: out_free:
/* it's reportedly faster than delegating the null check to kfree() */
if (iovec) if (iovec)
kfree(iovec); kfree(iovec);
return ret; return ret;
...@@ -3300,6 +3301,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, ...@@ -3300,6 +3301,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
return -EAGAIN; return -EAGAIN;
} }
out_free: out_free:
/* it's reportedly faster than delegating the null check to kfree() */
if (iovec) if (iovec)
kfree(iovec); kfree(iovec);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment