mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
net: Fix various endianness glitches
Sparse can help us find endianness bugs, but we need to make some cleanups to be able to more easily spot real bugs. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
cb903bf4ee
commit
0eae88f31c
17 changed files with 65 additions and 61 deletions
|
|
@ -123,8 +123,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
|
|||
case htons(ETH_P_IP):
|
||||
{
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
h = iph->daddr;
|
||||
h2 = iph->saddr ^ iph->protocol;
|
||||
h = (__force u32)iph->daddr;
|
||||
h2 = (__force u32)iph->saddr ^ iph->protocol;
|
||||
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
|
||||
(iph->protocol == IPPROTO_TCP ||
|
||||
iph->protocol == IPPROTO_UDP ||
|
||||
|
|
@ -138,8 +138,8 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
|
|||
case htons(ETH_P_IPV6):
|
||||
{
|
||||
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
h = iph->daddr.s6_addr32[3];
|
||||
h2 = iph->saddr.s6_addr32[3] ^ iph->nexthdr;
|
||||
h = (__force u32)iph->daddr.s6_addr32[3];
|
||||
h2 = (__force u32)iph->saddr.s6_addr32[3] ^ iph->nexthdr;
|
||||
if (iph->nexthdr == IPPROTO_TCP ||
|
||||
iph->nexthdr == IPPROTO_UDP ||
|
||||
iph->nexthdr == IPPROTO_UDPLITE ||
|
||||
|
|
@ -150,7 +150,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
h = (unsigned long)skb_dst(skb) ^ skb->protocol;
|
||||
h = (unsigned long)skb_dst(skb) ^ (__force u32)skb->protocol;
|
||||
h2 = (unsigned long)skb->sk;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue