]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: simplify snto32()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 3 Oct 2024 14:46:50 +0000 (07:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:04 +0000 (18:58 +0200)
commit7a7ba33110698166b488a06cdc04a16ca3dba176
treecae946b97bedefffc3c4e099bab2f6577386c89f
parenta905edfec7447e575ebbebc2535e854cefa4cf1c
HID: simplify snto32()

[ Upstream commit ae9b956cb26c0fd5a365629f2d723ab2fb14df79 ]

snto32() does exactly what sign_extend32() does, but handles
potentially malformed data coming from the device. Keep the checks,
but then call sign_extend32() to perform the actual conversion.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://patch.msgid.link/20241003144656.3786064-1-dmitry.torokhov@gmail.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Stable-dep-of: a6b87bfc2ab5 ("HID: core: Harden s32ton() against conversion to 0 bits")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-core.c