io_uring: rw: Fix an unsigned comparison which can never be negative
PATCH 1/1 io_uring: rw: Fix an unsigned comparison which can never be negative
The parameter 'res' is defined as unsigned type, so the following if statement is invalid, we can modify the type of res to long. if (res < 0)
res = io->bytes_done;
else
res += io->bytes_done;
io_uring/rw.c:265 io_fixup_rw_res() warn: unsigned 'res' is never less than zero.
Reported-by Abaci Robot <[email protected]>
Signed-off-by Jiapeng Chong <[email protected]>
--- io_uring/rw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/rw.c +1 -1
@@ -256,7 +256,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)return false; } -static inline unsigned io_fixup_rw_res (struct io_kiocb *req,unsigned res) +static inline unsigned io_fixup_rw_res (struct io_kiocb *req,long res) {struct io_async_rw *io = req->async_data;
Signature · 1 line
2.20.1.7.g153144c
Jens Axboe
maintainerQuoted 8 lines · Jiapeng Chong
The parameter 'res' is defined as unsigned type, so the following if statement is invalid, we can modify the type of res to long. if (res < 0)
res =io->bytes_done;
else
res +=io->bytes_done;
io_uring/rw.c:265io_fixup_rw_res()warn: unsigned 'res' is never less than zero.
This one is already fixed here:
Signature · 1 line
Jens Axboe