From patchwork Thu Jun 11 19:23:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 28578 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id EFDA4B7151 for ; Fri, 12 Jun 2009 05:23:38 +1000 (EST) Received: by ozlabs.org (Postfix) id D3DAEDDD0B; Fri, 12 Jun 2009 05:23:38 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 66A92DDD01 for ; Fri, 12 Jun 2009 05:23:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760729AbZFKTXR (ORCPT ); Thu, 11 Jun 2009 15:23:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757134AbZFKTXR (ORCPT ); Thu, 11 Jun 2009 15:23:17 -0400 Received: from gw1.cosmosbay.com ([212.99.114.194]:41738 "EHLO gw1.cosmosbay.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760709AbZFKTXP (ORCPT ); Thu, 11 Jun 2009 15:23:15 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by gw1.cosmosbay.com (8.13.7/8.13.7) with ESMTP id n5BJNEQf031335; Thu, 11 Jun 2009 21:23:15 +0200 Message-ID: <4A3159A3.1070504@cosmosbay.com> Date: Thu, 11 Jun 2009 21:23:15 +0200 From: Eric Dumazet User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: "David S. Miller" CC: Linux Netdev List Subject: [PATCH] net: ntohs() misuse X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (gw1.cosmosbay.com [0.0.0.0]); Thu, 11 Jun 2009 21:23:15 +0200 (CEST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: Eric Dumazet --- drivers/net/atl1e/atl1e_main.c | 4 ++-- drivers/net/atlx/atl1.c | 2 +- drivers/net/ioc3-eth.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c index e1ae10c..9fc6d6d 100644 --- a/drivers/net/atl1e/atl1e_main.c +++ b/drivers/net/atl1e/atl1e_main.c @@ -1602,7 +1602,7 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *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)) { proto_hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); @@ -1878,7 +1878,7 @@ static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev) TPD_VLAN_SHIFT; } - if (skb->protocol == ntohs(ETH_P_8021Q)) + if (skb->protocol == htons(ETH_P_8021Q)) tpd->word3 |= 1 << TPD_VL_TAGGED_SHIFT; if (skb_network_offset(skb) != ETH_HLEN) diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 560f387..94d7325 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c @@ -2382,7 +2382,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) mss = skb_shinfo(skb)->gso_size; if (mss) { - if (skb->protocol == ntohs(ETH_P_IP)) { + if (skb->protocol == htons(ETH_P_IP)) { proto_hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb)); if (unlikely(proto_hdr_len > len)) { diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index c5593f4..e3cfefa 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -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 * drop the packet as appropriate. */ - if (eh->h_proto != ntohs(ETH_P_IP)) + if (eh->h_proto != htons(ETH_P_IP)) return; ih = (struct iphdr *) ((char *)eh + ETH_HLEN);