]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
commit82f09a637dd3215bce5314664f0171cdc3e43bb5
treea56768dc27c6007d05318433152e9362a40b8386
parent4fb125192563670e820991de48f8db495ecc7ff7
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: 6a82582d9fa4 ("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