diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-09-15 15:59:04 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-09-18 16:44:24 +0200 |
commit | 6c667ef6e2c88523469a6a94493b441cac2970d9 (patch) | |
tree | b16314c93a3035c58c92a4c21a127582af7f2e37 /drivers/hid/hid-logitech-hidpp.c | |
parent | e1cd4004cde7c9b694bbdd8def0e02288ee58c74 (diff) | |
download | lwn-6c667ef6e2c88523469a6a94493b441cac2970d9.tar.gz lwn-6c667ef6e2c88523469a6a94493b441cac2970d9.zip |
HID: steelseries: Fix signedness bug in steelseries_headset_arctis_1_fetch_battery()
The hid_hw_raw_request() function returns negative error codes or the
number bytes transferred. The problem is that when it returns negative
error codes and we check if "ret < sizeof(arctis_1_battery_request)",
then the negative values are type promoted from int to high unsigned long
values and treated as success.
This was detected using Smatch:
drivers/hid/hid-steelseries.c:393 steelseries_headset_arctis_1_fetch_battery()
warn: error code type promoted to positive: 'ret'
Fixes: a0c76896c3fb ("HID: steelseries: Add support for Arctis 1 XBox")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-logitech-hidpp.c')
0 files changed, 0 insertions, 0 deletions