[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240403224551.GN538574@ZenIV>
Date: Wed, 3 Apr 2024 23:45:51 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Jens Axboe <axboe@...nel.dk>
Cc: linux-fsdevel@...r.kernel.org, brauner@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] userfaultfd: convert to ->read_iter()
On Wed, Apr 03, 2024 at 08:02:53AM -0600, Jens Axboe wrote:
> -		if (count < sizeof(msg))
> +		if (iov_iter_count(to) < sizeof(msg))
>  			return ret ? ret : -EINVAL;
>  		_ret = userfaultfd_ctx_read(ctx, no_wait, &msg, inode);
>  		if (_ret < 0)
>  			return ret ? ret : _ret;
> -		if (copy_to_user((__u64 __user *) buf, &msg, sizeof(msg)))
> +		_ret = copy_to_iter(&msg, sizeof(msg), to);
> +		if (_ret < 0)
>  			return ret ? ret : -EFAULT;
Take a look in uio.h - you'll see
size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i)
in there.  See the problem?
> +	fd = get_unused_fd_flags(O_RDONLY | (flags & UFFD_SHARED_FCNTL_FLAGS));
> +	if (fd < 0)
> +		goto err_out;
Same comment as for the previous patch.
Powered by blists - more mailing lists
 
