]> git.baikalelectronics.ru Git - kernel.git/commit
HID: ft260: improve error handling of ft260_hid_feature_report_get()
authorMichael Zaidman <michael.zaidman@gmail.com>
Tue, 11 May 2021 10:12:08 +0000 (13:12 +0300)
committerJiri Kosina <jkosina@suse.cz>
Thu, 27 May 2021 13:40:34 +0000 (15:40 +0200)
commitea2a76b02fbae9b64134946f62cf351c5b50d7a9
treea56768dc27c6007d05318433152e9362a40b8386
parent379f15f55956ebd50c21596c586aa8fec49a6d7f
HID: ft260: improve error handling of ft260_hid_feature_report_get()

The ft260_hid_feature_report_get() checks if the return size matches the
requested size. But the function can also fail with at least -ENOMEM.  Add the
< 0 checks.

In ft260_hid_feature_report_get(), do not do the memcpy to the caller's buffer
if there is an error.

Fixes: 4a7a7c8474a2 ("HID: ft260: add usb hid to i2c host bridge driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-ft260.c