io_uring/kbuf: fix signedness in this_len calculation
authorQingyue Zhang <chunzhennn@qq.com>
Wed, 27 Aug 2025 11:43:39 +0000 (19:43 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 27 Aug 2025 14:39:44 +0000 (08:39 -0600)
commitc64eff368ac676e8540344d27a3de47e0ad90d21
tree089c55d83a80667ce71b96721acfe9a0d5eedd44
parente4e6aaea46b7be818eba0510ba68d30df8689ea3
io_uring/kbuf: fix signedness in this_len calculation

When importing and using buffers, buf->len is considered unsigned.
However, buf->len is converted to signed int when committing. This can
lead to unexpected behavior if the buffer is large enough to be
interpreted as a negative value. Make min_t calculation unsigned.

Fixes: ae98dbf43d75 ("io_uring/kbuf: add support for incremental buffer consumption")
Co-developed-by: Suoxing Zhang <aftern00n@qq.com>
Signed-off-by: Suoxing Zhang <aftern00n@qq.com>
Signed-off-by: Qingyue Zhang <chunzhennn@qq.com>
Link: https://lore.kernel.org/r/tencent_4DBB3674C0419BEC2C0C525949DA410CA307@qq.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c