diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-11-20 22:15:32 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:30:14 -0500 |
commit | b1a98bf685e26f1a0b509d6f0f6bd8f7764303a5 (patch) | |
tree | 8767ff864e85bf2748d74906c9805993c67c216c | |
parent | 2afe37cdffa96f69c9096e6d4a10a275c9c7d2c9 (diff) |
[NET] neighbour: Use kmemdup where applicable
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
-rw-r--r-- | net/core/neighbour.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 0e097ba14d73..ba509a4a8e92 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1266,10 +1266,9 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
1266 | struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | 1266 | struct neigh_parms *neigh_parms_alloc(struct net_device *dev, |
1267 | struct neigh_table *tbl) | 1267 | struct neigh_table *tbl) |
1268 | { | 1268 | { |
1269 | struct neigh_parms *p = kmalloc(sizeof(*p), GFP_KERNEL); | 1269 | struct neigh_parms *p = kmemdup(&tbl->parms, sizeof(*p), GFP_KERNEL); |
1270 | 1270 | ||
1271 | if (p) { | 1271 | if (p) { |
1272 | memcpy(p, &tbl->parms, sizeof(*p)); | ||
1273 | p->tbl = tbl; | 1272 | p->tbl = tbl; |
1274 | atomic_set(&p->refcnt, 1); | 1273 | atomic_set(&p->refcnt, 1); |
1275 | INIT_RCU_HEAD(&p->rcu_head); | 1274 | INIT_RCU_HEAD(&p->rcu_head); |
@@ -2625,14 +2624,14 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
2625 | int p_id, int pdev_id, char *p_name, | 2624 | int p_id, int pdev_id, char *p_name, |
2626 | proc_handler *handler, ctl_handler *strategy) | 2625 | proc_handler *handler, ctl_handler *strategy) |
2627 | { | 2626 | { |
2628 | struct neigh_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL); | 2627 | struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, |
2628 | sizeof(*t), GFP_KERNEL); | ||
2629 | const char *dev_name_source = NULL; | 2629 | const char *dev_name_source = NULL; |
2630 | char *dev_name = NULL; | 2630 | char *dev_name = NULL; |
2631 | int err = 0; | 2631 | int err = 0; |
2632 | 2632 | ||
2633 | if (!t) | 2633 | if (!t) |
2634 | return -ENOBUFS; | 2634 | return -ENOBUFS; |
2635 | memcpy(t, &neigh_sysctl_template, sizeof(*t)); | ||
2636 | t->neigh_vars[0].data = &p->mcast_probes; | 2635 | t->neigh_vars[0].data = &p->mcast_probes; |
2637 | t->neigh_vars[1].data = &p->ucast_probes; | 2636 | t->neigh_vars[1].data = &p->ucast_probes; |
2638 | t->neigh_vars[2].data = &p->app_probes; | 2637 | t->neigh_vars[2].data = &p->app_probes; |