Commit 15665c06 authored by Zou Wei's avatar Zou Wei Committed by Greg Kroah-Hartman

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: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarZou Wei <zou_wei@huawei.com>
Link: https://lore.kernel.org/r/1587524330-119776-1-git-send-email-zou_wei@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8419759f
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment