summaryrefslogtreecommitdiff
path: root/Documentation/hwmon/ucd9000.rst
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2021-10-19 17:29:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-17 09:48:43 +0100
commitb216a39b3212afe141ad06fdde5f440e66b4c431 (patch)
tree8210e896543abe0b012f3782eae56f9435d4b5ca /Documentation/hwmon/ucd9000.rst
parentfae0552d83ff44fd225ae3de1297d6075f1c652b (diff)
HID: u2fzero: clarify error check and length calculations
[ Upstream commit b7abf78b7a6c4a29a6e0ba0bb883fe44a2f3d693 ] The previous commit fixed handling of incomplete packets but broke error handling: offsetof returns an unsigned value (size_t), but when compared against the signed return value, the return value is interpreted as if it were unsigned, so negative return values are never less than the offset. To make the code easier to read, calculate the minimal packet length once and separately, and assign it to a signed int variable to eliminate unsigned math and the need for type casts. It then becomes immediately obvious how the actual data length is calculated and why the return value cannot be less than the minimal length. Fixes: 22d65765f211 ("HID: u2fzero: ignore incomplete packets without data") Fixes: 42337b9d4d95 ("HID: add driver for U2F Zero built-in LED and RNG") Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'Documentation/hwmon/ucd9000.rst')
0 files changed, 0 insertions, 0 deletions