ethernet: call __skb_pull() in eth_type_trans()
Subsystems (2)
PATCH 1/1 ethernet: call __skb_pull() in eth_type_trans()
call __skb_pull() in eth_type_trans().
Since the callers of eth_type_trans() always feed it long enough packets, we can use __skb_pull() to save some cycles.
----
net/ethernet/eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethernet/eth.c +1 -1
@@ -162,7 +162,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) skb->dev = dev;skb_reset_mac_header (skb); -skb_pull_inline (skb,ETH_HLEN ); +__skb_pull (skb,ETH_HLEN ); eth =eth_hdr (skb);if (unlikely (is_multicast_ether_addr (eth->h_dest))) {
David Miller
maintainerFrom: Changli Gao <[email protected]>
Date: Mon, 3 May 2010 06:50:17 +0800
Quoted 6 lines
call
__skb_pull()ineth_type_trans().Since the callers of
eth_type_trans()always feed it long enough packets, we can use__skb_pull()to save some cycles.Signed-off-by Changli Gao <[email protected]>
Although they should, assuming that some runts won't show up here and never check for that condition at all is dangerous.
At least we should have a WARN_ON() check for skb->len < ETH_ZLEN here or similar.
So many other things get layered into ethernet, which means adding this length assumption without any checks is bound to lead to unpleasant surprises for somebody.