Skip to content

Commit 7498a45

Browse files
cappe987kuba-moo
authored andcommitted
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: f3cad26 ("net: sparx5: add hostmode with phylink support") Signed-off-by: Casper Andersson <casper.casan@gmail.com> Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com> Link: https://lore.kernel.org/r/20220825084955.684637-1-casper.casan@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 037c97b commit 7498a45

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_packet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap)
113113
/* This assumes STATUS_WORD_POS == 1, Status
114114
* just after last data
115115
*/
116+
if (!byte_swap)
117+
val = ntohl((__force __be32)val);
116118
byte_cnt -= (4 - XTR_VALID_BYTES(val));
117119
eof_flag = true;
118120
break;

0 commit comments

Comments
 (0)