Skip to content

Commit bd249b9

Browse files
Nikita ZhandarovichJiri Kosina
authored andcommitted
HID: wacom: avoid integer overflow in wacom_intuos_inout()
If high bit is set to 1 in ((data[3] & 0x0f << 28), after all arithmetic operations and integer promotions are done, high bits in wacom->serial[idx] will be filled with 1s as well. Avoid this, albeit unlikely, issue by specifying left operand's __u64 type for the right operand. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Fixes: 3bea733 ("USB: wacom tablet driver reorganization") Signed-off-by: Nikita Zhandarovich <[email protected]> Reviewed-by: Ping Cheng <[email protected]> Cc: [email protected] Signed-off-by: Jiri Kosina <[email protected]>
1 parent d9eef34 commit bd249b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hid/wacom_wac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
831831
/* Enter report */
832832
if ((data[1] & 0xfc) == 0xc0) {
833833
/* serial number of the tool */
834-
wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
834+
wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
835835
(data[4] << 20) + (data[5] << 12) +
836836
(data[6] << 4) + (data[7] >> 4);
837837

0 commit comments

Comments
 (0)