HID: logitech: don't use stack based dj_report structures
On a system with a logitech wireless keyboard/mouse and DMA-API debugging enabled, this warning appears at boot: kernel: WARNING: at lib/dma-debug.c:929 check_for_stack.part.12+0x70/0xa7() kernel: Hardware name: MS-7593 kernel: uhci_hcd 0000:00:1d.1: DMA-API: device driver maps memory fromstack [addr=ffff8801b0079c29] Make logi_dj_recv_query_paired_devices and logi_dj_recv_switch_to_dj_mode use a structure allocated with kzalloc rather than a stack based one. Signed-off-by: Marc Dionne <marc.c.dionne@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
3c2c4b73aa
commit
d8dc3494f7
1 changed files with 24 additions and 14 deletions
|
@ -436,27 +436,37 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
|
|||
|
||||
static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
|
||||
{
|
||||
struct dj_report dj_report;
|
||||
struct dj_report *dj_report;
|
||||
int retval;
|
||||
|
||||
memset(&dj_report, 0, sizeof(dj_report));
|
||||
dj_report.report_id = REPORT_ID_DJ_SHORT;
|
||||
dj_report.device_index = 0xFF;
|
||||
dj_report.report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES;
|
||||
return logi_dj_recv_send_report(djrcv_dev, &dj_report);
|
||||
dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
|
||||
if (!dj_report)
|
||||
return -ENOMEM;
|
||||
dj_report->report_id = REPORT_ID_DJ_SHORT;
|
||||
dj_report->device_index = 0xFF;
|
||||
dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES;
|
||||
retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
|
||||
kfree(dj_report);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
|
||||
unsigned timeout)
|
||||
{
|
||||
struct dj_report dj_report;
|
||||
struct dj_report *dj_report;
|
||||
int retval;
|
||||
|
||||
memset(&dj_report, 0, sizeof(dj_report));
|
||||
dj_report.report_id = REPORT_ID_DJ_SHORT;
|
||||
dj_report.device_index = 0xFF;
|
||||
dj_report.report_type = REPORT_TYPE_CMD_SWITCH;
|
||||
dj_report.report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
|
||||
dj_report.report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
|
||||
return logi_dj_recv_send_report(djrcv_dev, &dj_report);
|
||||
dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL);
|
||||
if (!dj_report)
|
||||
return -ENOMEM;
|
||||
dj_report->report_id = REPORT_ID_DJ_SHORT;
|
||||
dj_report->device_index = 0xFF;
|
||||
dj_report->report_type = REPORT_TYPE_CMD_SWITCH;
|
||||
dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
|
||||
dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
|
||||
retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
|
||||
kfree(dj_report);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue