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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Apr 2018 07:36:26 +0000 (09:36 +0200)
commitd6b3a5c87d45ba6af5597879c98024de1ff0f327
tree16bb0f5ff1918e465f6a0b56922b6ef5ad6d69b4
parent70dbed63a96d1f5ebc779c87f00340d352b3b0c5
HID: i2c-hid: fix size check and type usage

commit ac75a041048b8c1f7418e27621ca5efda8571043 upstream.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/i2c-hid/i2c-hid.c