On Tue, 19 Oct 2021, Andrej Shadura wrote: > 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@xxxxxxxxxxxxxxx> Both now applied, thanks. -- Jiri Kosina SUSE Labs