diff options
Diffstat (limited to 'net/sched/em_nbyte.c')
| -rw-r--r-- | net/sched/em_nbyte.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c index 71ea926a9f0..a3bed07a008 100644 --- a/net/sched/em_nbyte.c +++ b/net/sched/em_nbyte.c @@ -9,22 +9,20 @@ * Authors: Thomas Graf <tgraf@suug.ch> */ -#include <linux/config.h> +#include <linux/gfp.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> -#include <linux/sched.h> #include <linux/string.h> #include <linux/skbuff.h> #include <linux/tc_ematch/tc_em_nbyte.h> #include <net/pkt_cls.h> -struct nbyte_data -{ +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 +33,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 +67,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); } @@ -80,3 +76,5 @@ MODULE_LICENSE("GPL"); module_init(init_em_nbyte); module_exit(exit_em_nbyte); + +MODULE_ALIAS_TCF_EMATCH(TCF_EM_NBYTE); |
