]> git.karo-electronics.de Git - linux-beck.git/commitdiff
batman-adv: avoid skb_linearise() if not needed
authorAntonio Quartulli <ordex@autistici.org>
Fri, 16 Mar 2012 10:52:31 +0000 (11:52 +0100)
committerAntonio Quartulli <ordex@autistici.org>
Sun, 13 May 2012 16:24:37 +0000 (18:24 +0200)
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 <ordex@autistici.org>
net/batman-adv/routing.c

index 7ed9d8f92916b64e685faec33f88a896ae64c4b8..4c6467db881cfe99e4aa5b1a359c48cf561de83f 100644 (file)
@@ -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 +