]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: i2c-hid: fix size check and type usage
authorAaron Ma <aaron.ma@canonical.com>
Mon, 8 Jan 2018 02:41:40 +0000 (10:41 +0800)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:33 +0000 (21:36 -0400)
commit2e765a6629169d568f605ed7765e55e064abe62f
tree58a2c0b3787272282cc7943bb2859d78f1a35481
parent7d9b58eaa92ce774ab404661bd3b159165b036f5
HID: i2c-hid: fix size check and type usage

[ Upstream commit ac75a041048b8c1f7418e27621ca5efda8571043 ]

When convert char array with signed int, if the inbuf[x] is negative then
upper bits will be set to 1. Fix this by using u8 instead of char.

ret_size has to be at least 3, hid_input_report use it after minus 2 bytes.

Cc: stable@vger.kernel.org
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/hid/i2c-hid/i2c-hid.c