Skip to content
Commit 6c667ef6 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jiri Kosina
Browse files

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: a0c76896 ("HID: steelseries: Add support for Arctis 1 XBox")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarBastien Nocera <hadess@hadess.net>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent e1cd4004
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment