Skip to content

Commit

Permalink
HID: fix buffer allocations
Browse files Browse the repository at this point in the history
When using hid_output_report(), the buffer should be allocated by hid_alloc_report_buf(),
not a custom malloc.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Feb 3, 2014
1 parent 3db187e commit 9d27f43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ static void hidinput_led_worker(struct work_struct *work)

/* fall back to generic raw-output-report */
len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
buf = kmalloc(len, GFP_KERNEL);
buf = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf)
return;

Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/i2c-hid/i2c-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
int ret;
int len = i2c_hid_get_report_length(rep) - 2;

buf = kzalloc(len, GFP_KERNEL);
buf = hid_alloc_report_buf(rep, GFP_KERNEL);
if (!buf)
return;

Expand Down

0 comments on commit 9d27f43

Please sign in to comment.