Re: [PATCH] io_uring: rw: Fix an unsigned comparison which can never be negative

From: Jens Axboe
Date: Thu Sep 15 2022 - 02:27:30 EST


On 9/14/22 11:49 PM, Jiapeng Chong wrote:
> 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.

This one is already fixed here:

https://git.kernel.dk/cgit/linux-block/commit/?h=io_uring-6.0&id=62bb0647b14646fa6c9aa25ecdf67ad18f13523c

--
Jens Axboe