summaryrefslogtreecommitdiff
path: root/drivers/misc/xilinx_sdfec.c
diff options
context:
space:
mode:
authorZou Wei <zou_wei@huawei.com>2020-04-22 05:58:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 17:32:51 +0300
commit15665c062b8c529d162479b306af23bc37bb6a12 (patch)
treebf0feb0fe99a705d5d8278e076996a7da107ed9f /drivers/misc/xilinx_sdfec.c
parent8419759f98adb5a538a40efaf66ebe9d136bc3d4 (diff)
downloadlinux-15665c062b8c529d162479b306af23bc37bb6a12.tar.xz
misc: xilinx_sdfec: Use memdup_user() as a cleanup
Fix coccicheck warning which recommends to use memdup_user(). This patch fixes the following coccicheck warnings: drivers/misc/xilinx_sdfec.c:652:8-15: WARNING opportunity for memdup_user Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zou Wei <zou_wei@huawei.com> Link: https://lore.kernel.org/r/1587524330-119776-1-git-send-email-zou_wei@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/xilinx_sdfec.c')
-rw-r--r--drivers/misc/xilinx_sdfec.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 71bbaa56bdb5..7a7589417e87 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -649,14 +649,9 @@ static int xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
struct xsdfec_ldpc_params *ldpc;
int ret, n;
- ldpc = kzalloc(sizeof(*ldpc), GFP_KERNEL);
- if (!ldpc)
- return -ENOMEM;
-
- if (copy_from_user(ldpc, arg, sizeof(*ldpc))) {
- ret = -EFAULT;
- goto err_out;
- }
+ ldpc = memdup_user(arg, sizeof(*ldpc));
+ if (IS_ERR(ldpc))
+ return PTR_ERR(ldpc);
if (xsdfec->config.code == XSDFEC_TURBO_CODE) {
ret = -EIO;