projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
37c492c
)
HID: uhid: Use kmemdup instead of kmalloc + memcpy
author
Benoit Taine
<
[email protected]
>
Mon, 26 May 2014 15:21:25 +0000
(17:21 +0200)
committer
Jiri Kosina
<
[email protected]
>
Mon, 26 May 2014 22:41:05 +0000
(
00:41
+0200)
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: Benoit Taine <
[email protected]
>
Reviewed-by: David Herrmann <
[email protected]
>
Signed-off-by: Jiri Kosina <
[email protected]
>
drivers/hid/uhid.c
patch
|
blob
|
history
diff --git
a/drivers/hid/uhid.c
b/drivers/hid/uhid.c
index 0d078c32db4f20cce7c6bf57bfeb0b96e4ba2ec7..0cb92e3472589d7a6260fbdd0a9d4e308d165d74 100644
(file)
--- a/
drivers/hid/uhid.c
+++ b/
drivers/hid/uhid.c
@@
-441,12
+441,11
@@
static int uhid_dev_create2(struct uhid_device *uhid,
if (uhid->rd_size <= 0 || uhid->rd_size > HID_MAX_DESCRIPTOR_SIZE)
return -EINVAL;
- uhid->rd_data = kmalloc(uhid->rd_size, GFP_KERNEL);
+ uhid->rd_data = kmemdup(ev->u.create2.rd_data, uhid->rd_size,
+ GFP_KERNEL);
if (!uhid->rd_data)
return -ENOMEM;
- memcpy(uhid->rd_data, ev->u.create2.rd_data, uhid->rd_size);
-
hid = hid_allocate_device();
if (IS_ERR(hid)) {
ret = PTR_ERR(hid);