Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / sched / em_nbyte.c
index 71ea926a9f092fcce116144a94ea24d6eef76244..42103b2bdc519726f7c77152a61fc0d3e1d7622c 100644 (file)
@@ -9,7 +9,6 @@
  * Authors:    Thomas Graf <tgraf@suug.ch>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -24,7 +23,7 @@ struct nbyte_data
        struct tcf_em_nbyte     hdr;
        char                    pattern[0];
 };
-       
+
 static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
                           struct tcf_ematch *em)
 {
@@ -35,12 +34,10 @@ static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
                return -EINVAL;
 
        em->datalen = sizeof(*nbyte) + nbyte->len;
-       em->data = (unsigned long) kmalloc(em->datalen, GFP_KERNEL);
+       em->data = (unsigned long)kmemdup(data, em->datalen, GFP_KERNEL);
        if (em->data == 0UL)
                return -ENOBUFS;
 
-       memcpy((void *) em->data, data, em->datalen);
-
        return 0;
 }
 
@@ -71,7 +68,7 @@ static int __init init_em_nbyte(void)
        return tcf_em_register(&em_nbyte_ops);
 }
 
-static void __exit exit_em_nbyte(void) 
+static void __exit exit_em_nbyte(void)
 {
        tcf_em_unregister(&em_nbyte_ops);
 }