Commit 7498a457 authored by Casper Andersson's avatar Casper Andersson Committed by Jakub Kicinski

net: sparx5: fix handling uneven length packets in manual extraction

Packets that are not of length divisible by 4 (e.g. 77, 78, 79) would
have the checksum included up to next multiple of 4 (a 77 bytes packet
would have 3 bytes of ethernet checksum included). The check for the
value expects it in host (Little) endian.

Fixes: f3cad261 ("net: sparx5: add hostmode with phylink support")
Signed-off-by: default avatarCasper Andersson <casper.casan@gmail.com>
Reviewed-by: default avatarSteen Hegelund <Steen.Hegelund@microchip.com>
Link: https://lore.kernel.org/r/20220825084955.684637-1-casper.casan@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 037c97b2
......@@ -113,6 +113,8 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap)
/* This assumes STATUS_WORD_POS == 1, Status
* just after last data
*/
if (!byte_swap)
val = ntohl((__force __be32)val);
byte_cnt -= (4 - XTR_VALID_BYTES(val));
eof_flag = true;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment