提交 a809eff1 编写于 作者: F Fabian Frederick 提交者: Marcel Holtmann

Bluetooth: hidp: replace kzalloc/copy_from_user by memdup_user

use memdup_user for rd_data import.
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 2773b024
......@@ -736,14 +736,10 @@ static int hidp_setup_hid(struct hidp_session *session,
struct hid_device *hid;
int err;
session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
if (!session->rd_data)
return -ENOMEM;
session->rd_data = memdup_user(req->rd_data, req->rd_size);
if (IS_ERR(session->rd_data))
return PTR_ERR(session->rd_data);
if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) {
err = -EFAULT;
goto fault;
}
session->rd_size = req->rd_size;
hid = hid_allocate_device();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册