Commit 129c3b08 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

misc: xilinx_sdfec: Return -EFAULT if copy_from_user() fails



The copy_from_user() function returns the number of bytes remaining to
be copied but we want to return -EFAULT to the user.

Fixes: 20ec628e ("misc: xilinx_sdfec: Add ability to configure LDPC")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarMichal Simek <michal.simek@xilinx.com>
Reviewed-by: default avatarDragan Cvetic <dragan.cvetic@xilinx.com>
Link: https://lore.kernel.org/r/20190822083105.GI3964@kadam


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dac4f196
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -651,9 +651,10 @@ static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
	if (!ldpc)
		return -ENOMEM;

	ret = copy_from_user(ldpc, arg, sizeof(*ldpc));
	if (ret)
	if (copy_from_user(ldpc, arg, sizeof(*ldpc))) {
		ret = -EFAULT;
		goto err_out;
	}

	if (xsdfec->config.code == XSDFEC_TURBO_CODE) {
		ret = -EIO;