Skip to contentSkip to conversation

pasemi_mac: Access iph->tot_len with correct endianness

PATCH In review Roland Dreier 2 participants 2 messages Jul 1, 2008 – Jul 2, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pasemi_mac: Access iph->tot_len with correct endianness

iph->tot_len is stored in network byte order, so access it using ntohs(). This doesn't have any real world impact on pasemi_mac, since the device only exists as part of a big-endian system-on-chip, but fixing this gets rid of a sparse warning and avoids having a bad example in the tree.

---
 drivers/net/pasemi_mac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/pasemi_mac.c +1 -1
index 3b2a6c5..993d87c 100644
@@ -277,7 +277,7 @@ static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
 	*tcph = tcp_hdr(skb);
 
 	/* check if ip header and tcp header are complete */
-	if (iph->tot_len < ip_len + tcp_hdrlen(skb))
+	if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb))
 		return -1;
 
 	*hdr_flags = LRO_IPV4 | LRO_TCP;
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Roland Dreier

iph->tot_len is stored in network byte order, so access it using ntohs(). This doesn't have any real world impact on pasemi_mac, since the device only exists as part of a big-endian system-on-chip, but fixing this gets rid of a sparse warning and avoids having a bad example in the tree.