bfin_mac: fix memleak in mii_bus{probe|remove}
[safe/jmp/linux-2.6] / net / sched / em_text.c
index e8f4616..7632532 100644 (file)
@@ -9,6 +9,7 @@
  * Authors:    Thomas Graf <tgraf@suug.ch>
  */
 
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -118,11 +119,14 @@ static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
        conf.pattern_len = textsearch_get_pattern_len(tm->config);
        conf.pad = 0;
 
-       RTA_PUT_NOHDR(skb, sizeof(conf), &conf);
-       RTA_APPEND(skb, conf.pattern_len, textsearch_get_pattern(tm->config));
+       if (nla_put_nohdr(skb, sizeof(conf), &conf) < 0)
+               goto nla_put_failure;
+       if (nla_append(skb, conf.pattern_len,
+                      textsearch_get_pattern(tm->config)) < 0)
+               goto nla_put_failure;
        return 0;
 
-rtattr_failure:
+nla_put_failure:
        return -1;
 }
 
@@ -150,3 +154,5 @@ MODULE_LICENSE("GPL");
 
 module_init(init_em_text);
 module_exit(exit_em_text);
+
+MODULE_ALIAS_TCF_EMATCH(TCF_EM_TEXT);