]> git.baikalelectronics.ru Git - kernel.git/commit
mctp i2c: Fix hard head TX bounds length check
authorMatt Johnston <matt@codeconstruct.com.au>
Fri, 25 Feb 2022 05:39:38 +0000 (13:39 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 26 Feb 2022 06:23:33 +0000 (22:23 -0800)
commit4b1834355916f4a922686f665abf06cba1a7b861
tree741fe270dd693a65429a4c68c414209c3ed0d440
parentf6caabcbf0ca53d2e2fb99c85955fc0e8e903c6c
mctp i2c: Fix hard head TX bounds length check

We should be testing the length before fitting into the u8 byte_count.
This is just a sanity check, the MCTP stack should have limited to MTU
which is checked, and we check consistency later in mctp_i2c_xmit().

Found by Smatch
mctp_i2c_header_create() warn: impossible condition
    '(hdr->byte_count > 255) => (0-255 > 255)'

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mctp/mctp-i2c.c