]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/hid/i2c-hid/i2c-hid.c
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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 15:48:25 +0000 (11:48 -0400)
commit03b59dce47f9e6f9eb9a2d1da0c6104fa8cb0549
treef1b2e2df1630d61a9d2446400b339d9d01bdfc3c
parentc24e7621cdac379de4ba9affa04f10f6b2034cd2
HID: i2c-hid: fix size check and type usage

BugLink: http://bugs.launchpad.net/bugs/1773233
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/hid/i2c-hid/i2c-hid.c