From 8710e2613a4819aac44f4aed7e29027ac3eeb683 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Fri, 16 Mar 2012 11:52:31 +0100 Subject: batman-adv: avoid skb_linearise() if not needed Whenever we want to access headers only, we do not need to linearise the whole packet. Instead we can use pskb_may_pull() Signed-off-by: Antonio Quartulli --- net/batman-adv/routing.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'net/batman-adv/routing.c') diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 7ed9d8f92916..4c6467db881c 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -916,8 +916,9 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv, /* Check whether I have to reroute the packet */ if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { - /* Linearize the skb before accessing it */ - if (skb_linearize(skb) < 0) + /* check if there is enough data before accessing it */ + if (pskb_may_pull(skb, sizeof(struct unicast_packet) + + ETH_HLEN) < 0) return 0; ethhdr = (struct ethhdr *)(skb->data + -- cgit v1.2.3