From: Arnaldo Carvalho de Melo Date: Fri, 17 Nov 2006 13:18:20 +0000 (-0200) Subject: [IPV4]: Use kmemdup in net/ipv4/devinet.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=42e5ea466c1897c4ac2e3b4fe0b33a28e9e3d5de;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [IPV4]: Use kmemdup in net/ipv4/devinet.c Code diff stats: [acme@newtoy net-2.6.20]$ codiff /tmp/devinet.o.before /tmp/devinet.o.after /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/devinet.c: devinet_sysctl_register | -38 1 function changed, 38 bytes removed [acme@newtoy net-2.6.20]$ Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a1b356c8aa59..2fd899160f85 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1564,12 +1564,12 @@ static void devinet_sysctl_register(struct in_device *in_dev, { int i; struct net_device *dev = in_dev ? in_dev->dev : NULL; - struct devinet_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL); + struct devinet_sysctl_table *t = kmemdup(&devinet_sysctl, sizeof(*t), + GFP_KERNEL); char *dev_name = NULL; if (!t) return; - memcpy(t, &devinet_sysctl, sizeof(*t)); for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; t->devinet_vars[i].de = NULL;