Re: [PATCH] fs: Return -EFAULT if copy_to_user() fails

From: Matthew Wilcox
Date: Mon Mar 01 2021 - 07:53:49 EST


On Mon, Mar 01, 2021 at 07:26:00PM +0800, Wang Qing wrote:
> The copy_to_user() function returns the number of bytes remaining to be
> copied, but we want to return -EFAULT if the copy doesn't complete.

... which is done by the only caller.

if (set_fd_set(n, inp, fds.res_in) ||
set_fd_set(n, outp, fds.res_out) ||
set_fd_set(n, exp, fds.res_ex))
ret = -EFAULT;