Commit 9d27f432 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

HID: fix buffer allocations

When using hid_output_report(), the buffer should be allocated by hid_alloc_report_buf(),
not a custom malloc.
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 3db187e7
...@@ -1178,7 +1178,7 @@ static void hidinput_led_worker(struct work_struct *work) ...@@ -1178,7 +1178,7 @@ static void hidinput_led_worker(struct work_struct *work)
/* fall back to generic raw-output-report */ /* fall back to generic raw-output-report */
len = ((report->size - 1) >> 3) + 1 + (report->id > 0); len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
buf = kmalloc(len, GFP_KERNEL); buf = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf) if (!buf)
return; return;
......
...@@ -582,7 +582,7 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep, ...@@ -582,7 +582,7 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
int ret; int ret;
int len = i2c_hid_get_report_length(rep) - 2; int len = i2c_hid_get_report_length(rep) - 2;
buf = kzalloc(len, GFP_KERNEL); buf = hid_alloc_report_buf(rep, GFP_KERNEL);
if (!buf) if (!buf)
return; return;
......
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