summaryrefslogtreecommitdiffstats
path: root/net/sched/act_ipt.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-11-21 01:19:40 -0200
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:30:18 -0800
commitc7b1b24978d89efab7d420bbdc9557dbe6259c89 (patch)
treef9b05485df5d1cb1532d0251e3da782e1bbad9fe /net/sched/act_ipt.c
parentb3ab09f9e1681916df349d54232fbb3f8a79bfa5 (diff)
[SCHED]: Use kmemdup & kzalloc where appropriate
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/sched/act_ipt.c')
-rw-r--r--net/sched/act_ipt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index d8c9310da6e..a9608064a4c 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -156,10 +156,9 @@ static int tcf_ipt_init(struct rtattr *rta, struct rtattr *est,
rtattr_strlcpy(tname, tb[TCA_IPT_TABLE-1], IFNAMSIZ) >= IFNAMSIZ)
strcpy(tname, "mangle");
- t = kmalloc(td->u.target_size, GFP_KERNEL);
+ t = kmemdup(td, td->u.target_size, GFP_KERNEL);
if (unlikely(!t))
goto err2;
- memcpy(t, td, td->u.target_size);
if ((err = ipt_init_target(t, tname, hook)) < 0)
goto err3;
@@ -256,13 +255,12 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
** for foolproof you need to not assume this
*/
- t = kmalloc(ipt->tcfi_t->u.user.target_size, GFP_ATOMIC);
+ t = kmemdup(ipt->tcfi_t, ipt->tcfi_t->u.user.target_size, GFP_ATOMIC);
if (unlikely(!t))
goto rtattr_failure;
c.bindcnt = ipt->tcf_bindcnt - bind;
c.refcnt = ipt->tcf_refcnt - ref;
- memcpy(t, ipt->tcfi_t, ipt->tcfi_t->u.user.target_size);
strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name);
RTA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t);