Commit 17d0cdfa authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: ntohs() misuse

Some drivers incorrectly use ntohs() instead of htons()

A cleanup as htons() returns same result than ntohs(),
but better to use the proper one.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ee40c37
...@@ -1602,7 +1602,7 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb) ...@@ -1602,7 +1602,7 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
} }
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
if (skb->protocol == ntohs(ETH_P_IP) || if (skb->protocol == htons(ETH_P_IP) ||
(skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6)) { (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6)) {
proto_hdr_len = skb_transport_offset(skb) + proto_hdr_len = skb_transport_offset(skb) +
tcp_hdrlen(skb); tcp_hdrlen(skb);
...@@ -1878,7 +1878,7 @@ static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1878,7 +1878,7 @@ static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
TPD_VLAN_SHIFT; TPD_VLAN_SHIFT;
} }
if (skb->protocol == ntohs(ETH_P_8021Q)) if (skb->protocol == htons(ETH_P_8021Q))
tpd->word3 |= 1 << TPD_VL_TAGGED_SHIFT; tpd->word3 |= 1 << TPD_VL_TAGGED_SHIFT;
if (skb_network_offset(skb) != ETH_HLEN) if (skb_network_offset(skb) != ETH_HLEN)
......
...@@ -2382,7 +2382,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -2382,7 +2382,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
mss = skb_shinfo(skb)->gso_size; mss = skb_shinfo(skb)->gso_size;
if (mss) { if (mss) {
if (skb->protocol == ntohs(ETH_P_IP)) { if (skb->protocol == htons(ETH_P_IP)) {
proto_hdr_len = (skb_transport_offset(skb) + proto_hdr_len = (skb_transport_offset(skb) +
tcp_hdrlen(skb)); tcp_hdrlen(skb));
if (unlikely(proto_hdr_len > len)) { if (unlikely(proto_hdr_len > len)) {
......
...@@ -530,7 +530,7 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) ...@@ -530,7 +530,7 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len)
* case where the checksum is right the higher layers will still * case where the checksum is right the higher layers will still
* drop the packet as appropriate. * drop the packet as appropriate.
*/ */
if (eh->h_proto != ntohs(ETH_P_IP)) if (eh->h_proto != htons(ETH_P_IP))
return; return;
ih = (struct iphdr *) ((char *)eh + ETH_HLEN); ih = (struct iphdr *) ((char *)eh + ETH_HLEN);
......
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