summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-08-20 10:34:10 +0200
committerJens Axboe <axboe@kernel.dk>2020-08-20 13:36:17 +0200
commitf261c16861b82951bd2125706660ce4602930563 (patch)
treee29535552e257ac2733a0c44866ce6c29f0d0cba /fs
parentio_uring: fix racy req->flags modification (diff)
downloadlinux-f261c16861b82951bd2125706660ce4602930563.tar.xz
linux-f261c16861b82951bd2125706660ce4602930563.zip
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: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index d43a20a554e4..b9ca5a54dc20 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3204,6 +3204,7 @@ done:
kiocb_done(kiocb, ret, cs);
ret = 0;
out_free:
+ /* it's reportedly faster than delegating the null check to kfree() */
if (iovec)
kfree(iovec);
return ret;
@@ -3300,6 +3301,7 @@ copy_iov:
return -EAGAIN;
}
out_free:
+ /* it's reportedly faster than delegating the null check to kfree() */
if (iovec)
kfree(iovec);
return ret;