Re: [PATCH] io_uring: remove duplicate judgments when put_user_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <liuyun01@xxxxxxxxxx>
> ---
>   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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux