[DECNET]: Use kmemdup
authorArnaldo Carvalho de Melo <acme@mandriva.com>
Fri, 17 Nov 2006 14:29:21 +0000 (12:29 -0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:24:00 +0000 (21:24 -0800)
Code diff stats:

[acme@newtoy net-2.6.20]$ codiff /tmp/decnet.ko.before /tmp/decnet.ko.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/decnet/dn_dev.c:
  dn_dev_sysctl_register |  -51
 1 function changed, 51 bytes removed
[acme@newtoy net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/decnet/dn_dev.c

index 01861feb608dbbc8fe38dd2c3b65da3718205b9b..5b451e196fb963eea62b333db6c2e42da5ac0cce 100644 (file)
@@ -255,12 +255,10 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
        struct dn_dev_sysctl_table *t;
        int i;
 
-       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL);
        if (t == NULL)
                return;
 
-       memcpy(t, &dn_dev_sysctl, sizeof(*t));
-
        for(i = 0; i < ARRAY_SIZE(t->dn_dev_vars) - 1; i++) {
                long offset = (long)t->dn_dev_vars[i].data;
                t->dn_dev_vars[i].data = ((char *)parms) + offset;