Commit aa320fdb authored by José Expósito's avatar José Expósito Committed by Jiri Kosina

HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad

The function performs a check on the hdev input parameters, however, it
is used before the check.

Initialize the udev variable after the sanity check to avoid a
possible NULL pointer dereference.

Fixes: 9614219e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443763 ("Null pointer dereference")
Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent ff6b548a
......@@ -452,7 +452,7 @@ static int uclogic_params_frame_init_v1_buttonpad(
{
int rc;
bool found = false;
struct usb_device *usb_dev = hid_to_usb_dev(hdev);
struct usb_device *usb_dev;
char *str_buf = NULL;
const size_t str_len = 16;
......@@ -462,6 +462,8 @@ static int uclogic_params_frame_init_v1_buttonpad(
goto cleanup;
}
usb_dev = hid_to_usb_dev(hdev);
/*
* Enable generic button mode
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment