提交 a7d3e63f 编写于 作者: L Linus Torvalds

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
...@@ -1258,6 +1258,7 @@ static const struct acpi_device_id elan_acpi_id[] = { ...@@ -1258,6 +1258,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
{ "ELAN0605", 0 }, { "ELAN0605", 0 },
{ "ELAN0609", 0 }, { "ELAN0609", 0 },
{ "ELAN060B", 0 }, { "ELAN060B", 0 },
{ "ELAN0611", 0 },
{ "ELAN1000", 0 }, { "ELAN1000", 0 },
{ } { }
}; };
......
...@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, ...@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
unsigned int trackstick_button = BTN_LEFT; unsigned int trackstick_button = BTN_LEFT;
bool button_mapped = false; bool button_mapped = false;
int i; int i;
int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END);
f30->gpioled_key_map = devm_kcalloc(&fn->dev, f30->gpioled_key_map = devm_kcalloc(&fn->dev,
f30->gpioled_count, button_count,
sizeof(f30->gpioled_key_map[0]), sizeof(f30->gpioled_key_map[0]),
GFP_KERNEL); GFP_KERNEL);
if (!f30->gpioled_key_map) { if (!f30->gpioled_key_map) {
...@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, ...@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn,
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < f30->gpioled_count; i++) { for (i = 0; i < button_count; i++) {
if (!rmi_f30_is_valid_button(i, f30->ctrl)) if (!rmi_f30_is_valid_button(i, f30->ctrl))
continue; continue;
......
...@@ -230,13 +230,17 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -230,13 +230,17 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
/* Walk this report and pull out the info we need */ /* Walk this report and pull out the info we need */
while (i < length) { while (i < length) {
prefix = report[i]; prefix = report[i++];
/* Skip over prefix */
i++;
/* Determine data size and save the data in the proper variable */ /* Determine data size and save the data in the proper variable */
size = PREF_SIZE(prefix); size = (1U << PREF_SIZE(prefix)) >> 1;
if (i + size > length) {
dev_err(ddev,
"Not enough data (need %d, have %d)\n",
i + size, length);
break;
}
switch (size) { switch (size) {
case 1: case 1:
data = report[i]; data = report[i];
...@@ -244,8 +248,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, ...@@ -244,8 +248,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report,
case 2: case 2:
data16 = get_unaligned_le16(&report[i]); data16 = get_unaligned_le16(&report[i]);
break; break;
case 3: case 4:
size = 4;
data32 = get_unaligned_le32(&report[i]); data32 = get_unaligned_le32(&report[i]);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册