Skip to content

Commit

Permalink
io_uring: fix off-by-one in BUILD_BUG_ON check of __REQ_F_LAST_BIT
Browse files Browse the repository at this point in the history
Build check of __REQ_F_LAST_BIT should be larger than, not equal or larger
than. It's perfectly valid to have __REQ_F_LAST_BIT be 32, as that means
that the last valid bit is 31 which does fit in the type.

Signed-off-by: Hao Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Hao Xu authored and axboe committed Sep 10, 2021
1 parent 2ae2eb9 commit 32c2d33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -10863,7 +10863,7 @@ static int __init io_uring_init(void)
BUILD_BUG_ON(SQE_VALID_FLAGS >= (1 << 8));

BUILD_BUG_ON(ARRAY_SIZE(io_op_defs) != IORING_OP_LAST);
BUILD_BUG_ON(__REQ_F_LAST_BIT >= 8 * sizeof(int));
BUILD_BUG_ON(__REQ_F_LAST_BIT > 8 * sizeof(int));

req_cachep = KMEM_CACHE(io_kiocb, SLAB_HWCACHE_ALIGN | SLAB_PANIC |
SLAB_ACCOUNT);
Expand Down

0 comments on commit 32c2d33

Please sign in to comment.