Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[pandora-kernel.git] / net / sched / act_simple.c
index 901571a..36e1eda 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/rtnetlink.h>
+#include <net/netlink.h>
 #include <net/pkt_sched.h>
 
 #define TCA_ACT_SIMP 22
@@ -43,9 +44,9 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result
        d->tcf_bstats.bytes += skb->len;
        d->tcf_bstats.packets++;
 
-       /* print policy string followed by _ then packet count 
-        * Example if this was the 3rd packet and the string was "hello" 
-        * then it would look like "hello_3" (without quotes) 
+       /* print policy string followed by _ then packet count
+        * Example if this was the 3rd packet and the string was "hello"
+        * then it would look like "hello_3" (without quotes)
         **/
        printk("simple: %s_%d\n",
               (char *)d->tcfd_defdata, d->tcf_bstats.packets);
@@ -71,11 +72,10 @@ static int tcf_simp_release(struct tcf_defact *d, int bind)
 
 static int alloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata)
 {
-       d->tcfd_defdata = kmalloc(datalen, GFP_KERNEL);
+       d->tcfd_defdata = kmemdup(defdata, datalen, GFP_KERNEL);
        if (unlikely(!d->tcfd_defdata))
                return -ENOMEM;
        d->tcfd_datalen = datalen;
-       memcpy(d->tcfd_defdata, defdata, datalen);
        return 0;
 }
 
@@ -156,7 +156,7 @@ static inline int tcf_simp_cleanup(struct tc_action *a, int bind)
 static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
                                int bind, int ref)
 {
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tcf_defact *d = a->priv;
        struct tc_defact opt;
        struct tcf_t t;
@@ -174,7 +174,7 @@ static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
        return skb->len;
 
 rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }