Re: [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area()

Gabriel Krisman Bertazi <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.kernel.vger.linux-kernel
Organization SUSE
Message-ID <[email protected]>
Yi Xie <[email protected]> writes:

> Use PTR_ERR() on validate failure, like io_uring_mmap().

FWIW, this is not about using PTR_ERR, but about changing the return on
error to -EINVAL, which is what is returned by
io_uring_validate_mmap_request.  The commit message should reflect that,
specially because this is returned to userspace eventually, and might
break some application checks..


> Signed-off-by: Yi Xie <[email protected]>
> ---
>  io_uring/memmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/memmap.c b/io_uring/memmap.c
> index da1f6c5d07f8..23e8a85111bc 100644
> --- a/io_uring/memmap.c
> +++ b/io_uring/memmap.c
> @@ -337,7 +337,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,
>  
>  	ptr = io_uring_validate_mmap_request(filp, pgoff);
>  	if (IS_ERR(ptr))
> -		return -ENOMEM;
> +		return PTR_ERR(ptr);
>  
>  	/*
>  	 * Some architectures have strong cache aliasing requirements.
> -- 
> 2.25.1
>

-- 
Gabriel Krisman Bertazi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.