drivers/hid: fix brackets in comments
Subsystems (3)
PATCH 1/1 drivers/hid: fix brackets in comments
Remove multiple ')' without opening '(' and add missing '(' in comments.
--- .../hid_descriptor/amd_sfh_hid_report_desc.h | 12 ++++++------ drivers/hid/wacom_wac.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +6 -6
@@ -81,7 +81,7 @@ static const u8 accel3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x52 ,0x14 ,/* Sensor data motion accel and mod change sensitivity ABS) */ +0x0A ,0x52 ,0x14 ,/* Sensor data motion accel and mod change sensitivity ABS */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26, 0xFF, 0xFF, /* HID logical Max_16(0xFF,0xFF) */
@@ -248,7 +248,7 @@ static const u8 gyro3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x56 ,0x14 ,/* Angular velocity and mod change sensitivity ABS)*/ +0x0A ,0x56 ,0x14 ,/* Angular velocity and mod change sensitivity ABS*/ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26, 0xFF, 0xFF, /* HID logical Max_16(0xFF,0xFF) */
@@ -408,7 +408,7 @@ static const u8 comp3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x71 ,0x14 ,/* Orientation and mod change sensitivity ABS)*/ +0x0A ,0x71 ,0x14 ,/* Orientation and mod change sensitivity ABS*/ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0xFF ,0xFF ,/* HID logical Max_16(0xFF,0xFF) */ 0x75, 16, /* HID report size(16) */
@@ -429,14 +429,14 @@ static const u8 comp3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0x0F ,/* HID unit exponent(0x0F) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x84 ,0x14 ,/* Maganetic flux and change sensitivity ABS) */ +0x0A ,0x84 ,0x14 ,/* Maganetic flux and change sensitivity ABS */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0xFF ,0xFF ,/* HID logical Max_16(0xFF,0xFF) */ 0x75 ,16 ,/* HID report size(16) */ 0x95 ,1 ,/* HID report count(1) */ 0x55 ,0x0E ,/* HID unit exponent(0x0E) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x84 ,0x24 ,/* Maganetic flux and mod change sensitivity Max) */ +0x0A ,0x84 ,0x24 ,/* Maganetic flux and mod change sensitivity Max */ 0x16 ,0x01 ,0x80 ,/* HID logical Min_16(0x01,0x80) */ 0x26 ,0xFF ,0x7F ,/* HID logical Max_16(0xFF,0x7F) */ 0x75, 16, /* HID report size(16) */
@@ -581,7 +581,7 @@ static const u8 als_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0xD1 ,0xE4 ,/* Light illuminance and sensitivity REL PCT) */ +0x0A ,0xD1 ,0xE4 ,/* Light illuminance and sensitivity REL PCT */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0x10 ,0x27 ,/* HID logical Max_16(0x10,0x27) */ 0x75, 16, /* HID report size(16) */
drivers/hid/wacom_wac.c +1 -1
@@ -546,7 +546,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)* physically implemented as a touchstrip. Each button * is approximately 3 bits wide with a 2 bit spacing. * The raw touchstrip bits are stored at: -* ((data[3] & 0x1f) << 8) | data[4]) +* (((data[3] & 0x1f) << 8) | data[4]) */ nkeys =3 ; keys = ((data[3] & 0x1C) ? 1<<2 : 0) |
Signature · 1 line
2.54.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] HID: wacom: null pointer…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [Critical] HID: wacom: null pointer dereference in wacom_intuos_irq()
[1]
--
commit fe38a9c78cbb9c5469865293835934f3d81cedd9
Author: Manuel Ebner <[email protected]>
drivers/hid: fix brackets in comments
This commit removes unmatched closing parentheses and adds a missing opening parenthesis in comments in the AMD SFH and Wacom HID drivers.
drivers/hid/wacom_wac.c static int wacom_intuos_pad(struct wacom_wac *wacom) · line 564
Quoted 13 lines
drivers/hid/wacom_wac.c +1
-1@@ -558,7 +558,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)* physically implemented as a touchstrip. Each button * is approximately 3 bits wide with a 2 bit spacing. * The raw touchstrip bits are stored at: -* ((data[3] & 0x1f) << 8) | data[4]) +* (((data[3] & 0x1f) << 8) | data[4]) */ nkeys =3 ; keys = ((data[3] & 0x1C) ? 1<<2 : 0) |
[Severity: Critical]
This problem wasn't introduced by this patch, but can wacom_intuos_pad() and wacom_intuos_irq() dereference a NULL wacom->pad_input or wacom->pen_input pointer [1]?
When a device interface lacks pen or pad capabilities, the driver does not allocate the corresponding input_dev, leaving wacom->pen_input or wacom->pad_input NULL. If a report arrives on that interface, wacom_intuos_irq() dereferences wacom->pen_input in dev_dbg() on unknown report IDs, or dispatches recognized reports to wacom_intuos_pad() and wacom_intuos_general(), which report events through wacom->pad_input and wacom->pen_input without checking whether they were allocated:
drivers/hid/wacom_wac.c:wacom_intuos_irq() {
unsigned char *data = wacom->data;
struct input_dev *input = wacom->pen_input;
int result;
if (data[0] != WACOM_REPORT_PENABLED &&
...
data[0] != WACOM_REPORT_INTUOS5PAD) {
dev_dbg(input->dev.parent,
"%s: received unknown report #%d\n", __func__, data[0]);
return 0;
}
/* process pad events */
result = wacom_intuos_pad(wacom);
if (result)
return result;
...
/* process general packets */
result = wacom_intuos_general(wacom);
...
}Receiving a crafted report on an interface without the corresponding input_dev triggers a NULL pointer dereference and crashes the kernel.
[1] https://sashiko.dev/#/bug/linux-4a2bc3f1-bd42-421b-b885-0a54a4969fdf
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 5 lines · Manuel Ebner
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Remove multiple ')' without opening '(' and add missing '(' in comments.
Signed-off-by Manuel Ebner <[email protected]>
Thanks,
--
Basavaraj
Quoted 78 lines
--- .../hid_descriptor/amd_sfh_hid_report_desc.h | 12 ++++++------ drivers/hid/wacom_wac.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +6
-6@@ -81,7 +81,7 @@ static const u8 accel3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x52 ,0x14 ,/* Sensor data motion accel and mod change sensitivity ABS) */ +0x0A ,0x52 ,0x14 ,/* Sensor data motion accel and mod change sensitivity ABS */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26, 0xFF, 0xFF, /* HID logical Max_16(0xFF,0xFF) */@@ -248,7 +248,7 @@ static const u8 gyro3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x56 ,0x14 ,/* Angular velocity and mod change sensitivity ABS)*/ +0x0A ,0x56 ,0x14 ,/* Angular velocity and mod change sensitivity ABS*/ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26, 0xFF, 0xFF, /* HID logical Max_16(0xFF,0xFF) */@@ -408,7 +408,7 @@ static const u8 comp3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x71 ,0x14 ,/* Orientation and mod change sensitivity ABS)*/ +0x0A ,0x71 ,0x14 ,/* Orientation and mod change sensitivity ABS*/ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0xFF ,0xFF ,/* HID logical Max_16(0xFF,0xFF) */ 0x75, 16, /* HID report size(16) */@@ -429,14 +429,14 @@ static const u8 comp3_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0x0F ,/* HID unit exponent(0x0F) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x84 ,0x14 ,/* Maganetic flux and change sensitivity ABS) */ +0x0A ,0x84 ,0x14 ,/* Maganetic flux and change sensitivity ABS */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0xFF ,0xFF ,/* HID logical Max_16(0xFF,0xFF) */ 0x75 ,16 ,/* HID report size(16) */ 0x95 ,1 ,/* HID report count(1) */ 0x55 ,0x0E ,/* HID unit exponent(0x0E) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0x84 ,0x24 ,/* Maganetic flux and mod change sensitivity Max) */ +0x0A ,0x84 ,0x24 ,/* Maganetic flux and mod change sensitivity Max */ 0x16 ,0x01 ,0x80 ,/* HID logical Min_16(0x01,0x80) */ 0x26 ,0xFF ,0x7F ,/* HID logical Max_16(0xFF,0x7F) */ 0x75, 16, /* HID report size(16) */@@ -581,7 +581,7 @@ static const u8 als_report_descriptor[] = {0x95 ,1 ,/* HID report count(1) */ 0x55 ,0 ,/* HID unit exponent(0) */ 0xB1 ,0x02 ,/* HID feature (Data_Arr_Abs) */ -0x0A ,0xD1 ,0xE4 ,/* Light illuminance and sensitivity REL PCT) */ +0x0A ,0xD1 ,0xE4 ,/* Light illuminance and sensitivity REL PCT */ 0x15 ,0 ,/* HID logical Min_8(0) */ 0x26 ,0x10 ,0x27 ,/* HID logical Max_16(0x10,0x27) */ 0x75, 16, /* HID report size(16) */drivers/hid/wacom_wac.c +1
-2@@ -546,7 +546,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)* physically implemented as a touchstrip. Each button * is approximately 3 bits wide with a 2 bit spacing. * The raw touchstrip bits are stored at: -* ((data[3] & 0x1f) << 8) | data[4]) +* (((data[3] & 0x1f) << 8) | data[4]) */ nkeys =3 ; keys = ((data[3] & 0x1C) ? 1<<2 : 0) | --2.54.0