diff options
author | Jiri Kosina <jkosina@suse.cz> | 2016-06-20 05:16:18 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2016-06-20 05:16:18 -0400 |
commit | 63b3a7d0f933ebf25961e602c2eb11d658fef912 (patch) | |
tree | e4284b2b56b5466ec70bb6009b33129c56d1e0ce | |
parent | 41f61ecc501ca970ae8d9955c57405dc4abfab5a (diff) |
HID: alps: pass correct sizes to hid_hw_raw_request()
Calculating size of the report as sizeof(pointer) always passess the length
corresponding to the pointer type, not the underlying data report.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-alps.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 098bce621c6c..ff64c92906a6 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c | |||
@@ -136,7 +136,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address, | |||
136 | 136 | ||
137 | input[7] = check_sum; | 137 | input[7] = check_sum; |
138 | ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input, | 138 | ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, input, |
139 | sizeof(input), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 139 | sizeof(u8)*U1_FEATURE_REPORT_LEN, HID_FEATURE_REPORT, |
140 | HID_REQ_SET_REPORT); | ||
140 | 141 | ||
141 | if (ret < 0) { | 142 | if (ret < 0) { |
142 | dev_err(&hdev->dev, "failed to read command (%d)\n", ret); | 143 | dev_err(&hdev->dev, "failed to read command (%d)\n", ret); |
@@ -145,8 +146,8 @@ static int u1_read_write_register(struct hid_device *hdev, u32 address, | |||
145 | 146 | ||
146 | if (read_flag) { | 147 | if (read_flag) { |
147 | ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf, | 148 | ret = hid_hw_raw_request(hdev, U1_FEATURE_REPORT_ID, readbuf, |
148 | sizeof(readbuf), HID_FEATURE_REPORT, | 149 | sizeof(u8)*U1_FEATURE_REPORT_LEN, |
149 | HID_REQ_GET_REPORT); | 150 | HID_FEATURE_REPORT, HID_REQ_GET_REPORT); |
150 | 151 | ||
151 | if (ret < 0) { | 152 | if (ret < 0) { |
152 | dev_err(&hdev->dev, "failed read register (%d)\n", ret); | 153 | dev_err(&hdev->dev, "failed read register (%d)\n", ret); |