diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-11-14 13:35:05 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-14 19:30:16 -0500 |
commit | a809eff11f81e2dcf1e792586ef70693c60d7dc8 (patch) | |
tree | 64b569a699a83caf4ef36ed40f3db693792ddd96 | |
parent | 2773b024229bab23ef36e198e0555630f74f23ef (diff) |
Bluetooth: hidp: replace kzalloc/copy_from_user by memdup_user
use memdup_user for rd_data import.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/hidp/core.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 1b7d605706aa..cc25d0b74b36 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -736,14 +736,10 @@ static int hidp_setup_hid(struct hidp_session *session, | |||
736 | struct hid_device *hid; | 736 | struct hid_device *hid; |
737 | int err; | 737 | int err; |
738 | 738 | ||
739 | session->rd_data = kzalloc(req->rd_size, GFP_KERNEL); | 739 | session->rd_data = memdup_user(req->rd_data, req->rd_size); |
740 | if (!session->rd_data) | 740 | if (IS_ERR(session->rd_data)) |
741 | return -ENOMEM; | 741 | return PTR_ERR(session->rd_data); |
742 | 742 | ||
743 | if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) { | ||
744 | err = -EFAULT; | ||
745 | goto fault; | ||
746 | } | ||
747 | session->rd_size = req->rd_size; | 743 | session->rd_size = req->rd_size; |
748 | 744 | ||
749 | hid = hid_allocate_device(); | 745 | hid = hid_allocate_device(); |