Skip to content

Commit a7d3e63

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov: - fix gtco tablet driver, tightening parsing of HID descriptors - add ACPI ID added to Elan driver to be able to handle touchpads found in Lenovo Ideapad 320/520 - fix the Symaptics RMI4 driver to adjust handling of buttons * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: synaptics-rmi4 - limit the range of what GPIOs are buttons Input: gtco - fix potential out-of-bound access Input: elan_i2c - add ELAN0611 to the ACPI table
2 parents 22450e0 + 3e64fcb commit a7d3e63

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

drivers/input/mouse/elan_i2c_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
12581258
{ "ELAN0605", 0 },
12591259
{ "ELAN0609", 0 },
12601260
{ "ELAN060B", 0 },
1261+
{ "ELAN0611", 0 },
12611262
{ "ELAN1000", 0 },
12621263
{ }
12631264
};

drivers/input/rmi4/rmi_f30.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,18 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
232232
unsigned int trackstick_button = BTN_LEFT;
233233
bool button_mapped = false;
234234
int i;
235+
int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END);
235236

236237
f30->gpioled_key_map = devm_kcalloc(&fn->dev,
237-
f30->gpioled_count,
238+
button_count,
238239
sizeof(f30->gpioled_key_map[0]),
239240
GFP_KERNEL);
240241
if (!f30->gpioled_key_map) {
241242
dev_err(&fn->dev, "Failed to allocate gpioled map memory.\n");
242243
return -ENOMEM;
243244
}
244245

245-
for (i = 0; i < f30->gpioled_count; i++) {
246+
for (i = 0; i < button_count; i++) {
246247
if (!rmi_f30_is_valid_button(i, f30->ctrl))
247248
continue;
248249

drivers/input/tablet/gtco.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,25 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
230230

231231
/* Walk this report and pull out the info we need */
232232
while (i < length) {
233-
prefix = report[i];
234-
235-
/* Skip over prefix */
236-
i++;
233+
prefix = report[i++];
237234

238235
/* Determine data size and save the data in the proper variable */
239-
size = PREF_SIZE(prefix);
236+
size = (1U << PREF_SIZE(prefix)) >> 1;
237+
if (i + size > length) {
238+
dev_err(ddev,
239+
"Not enough data (need %d, have %d)\n",
240+
i + size, length);
241+
break;
242+
}
243+
240244
switch (size) {
241245
case 1:
242246
data = report[i];
243247
break;
244248
case 2:
245249
data16 = get_unaligned_le16(&report[i]);
246250
break;
247-
case 3:
248-
size = 4;
251+
case 4:
249252
data32 = get_unaligned_le32(&report[i]);
250253
break;
251254
}

0 commit comments

Comments
 (0)