diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-08-22 11:31:05 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-23 00:28:10 +0300 |
commit | 129c3b082c636087a72a30b17c87c57d197f08f5 (patch) | |
tree | 11a33c03ae31494f70b841b56ec4a6d6deaa4562 /drivers | |
parent | dac4f1964a9cbfbf81df8d31caa04ced0d7613b5 (diff) | |
download | linux-129c3b082c636087a72a30b17c87c57d197f08f5.tar.xz |
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: 20ec628e8007 ("misc: xilinx_sdfec: Add ability to configure LDPC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
Link: https://lore.kernel.org/r/20190822083105.GI3964@kadam
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/xilinx_sdfec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index dc1b8b412712..813b82c59360 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -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; |