projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b18a1a4
)
io_uring: add build check for buf_index overflows
author
Pavel Begunkov
<asml.silence@gmail.com>
Wed, 25 Aug 2021 19:51:40 +0000
(20:51 +0100)
committer
Jens Axboe
<axboe@kernel.dk>
Fri, 27 Aug 2021 15:23:11 +0000
(09:23 -0600)
req->buf_index is u16 and so we rely on registered buffers indexes
fitting into it. Add a build check, so when the upper limit for the
number of buffers is lifted we get a compliation fail but not lurking
problems.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link:
https://lore.kernel.org/r/787e8e1a17cea51ca6301426b1c4c4887b8bd676.1629920396.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
patch
|
blob
|
history
diff --git
a/fs/io_uring.c
b/fs/io_uring.c
index 09194f7276babf67a76f50e4bd9d7ce21d825e07..53326449d68563a36a78451b4e9659d0e93fb8c4 100644
(file)
--- a/
fs/io_uring.c
+++ b/
fs/io_uring.c
@@
-10493,6
+10493,10
@@
static int __init io_uring_init(void)
sizeof(struct io_uring_rsrc_update));
BUILD_BUG_ON(sizeof(struct io_uring_rsrc_update) >
sizeof(struct io_uring_rsrc_update2));
+
+ /* ->buf_index is u16 */
+ BUILD_BUG_ON(IORING_MAX_REG_BUFFERS >= (1u << 16));
+
/* should fit into one byte */
BUILD_BUG_ON(SQE_VALID_FLAGS >= (1 << 8));