Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / sched / em_nbyte.c
index cc80babfd79ff6870cd4b982f446721b67da777f..42103b2bdc519726f7c77152a61fc0d3e1d7622c 100644 (file)
@@ -23,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)
 {
@@ -34,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;
 }
 
@@ -70,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);
 }