On 8/5/19 8:37 PM, Jackie Liu wrote:
> When pret is less than or equal to 0, put_user_pages can be
> processed correctly.
> 
> Signed-off-by: Jackie Liu <[email protected]>
> ---
>   fs/io_uring.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 8a1de5a..be1e010 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2959,8 +2959,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx 
> *ctx, void __user *arg,
>                        * if we did partial map, or found file backed vmas,
>                        * release any pages we did get
>                        */
> -                     if (pret > 0)
> -                             put_user_pages(pages, pret);
> +                     put_user_pages(pages, pret);

Let's not do this, it's confusing and someone reviewing this code would
have to look it up every time. It's not in a hot path either.

-- 
Jens Axboe

Reply via email to