HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init
authorJosé Expósito <jose.exposito89@gmail.com>
Wed, 5 Jan 2022 17:29:14 +0000 (18:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:55 +0000 (11:03 +0100)
commitfc8a47ed624bd29b0ae91fbd96019274c87870cc
tree8eacba6ac758e88b93c0250f18f27f830dcf0852
parent964e6a78cb1df2ca1a4ec92bd6159ff93483032d
HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init

[ Upstream commit ff6b548afe4d9d1ff3a0f6ef79e8cbca25d8f905 ]

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

Initialize the stack variables after checking the input parameters to
avoid a possible NULL pointer dereference.

Fixes: 9614219e9310e ("HID: uclogic: Extract tablet parameter discovery into a module")
Addresses-Coverity-ID: 1443804 ("Null pointer dereference")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-uclogic-params.c