6/7 replace net_sysctl_strdup by kstrdup
Subsystems (3)
PATCH 1/1 6/7 replace net_sysctl_strdup by kstrdup
This patch removes a strdup implmentation in the networking layer (net_sysctl_strdup), and updates it to use the kstrdup library function.
Signed-off-by Paulo Marques <[email protected]>
--
Paulo Marques - www.grupopie.com
All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke (1729 - 1797)
include/linux/netdevice.h +0 -4
@@ -929,10 +929,6 @@ extern int skb_checksum_help(struct sk_bextern void net_enable_timestamp (void );extern void net_disable_timestamp (void ); -#ifdef CONFIG_SYSCTL -extern char *net_sysctl_strdup (const char *s); -#endif -#endif /* __KERNEL__ */ #endif /* _LINUX_DEV_H */
net/core/sysctl_net_core.c +0 -15
@@ -35,19 +35,6 @@ extern int sysctl_somaxconn;extern char sysctl_divert_version[];#endif /* CONFIG_NET_DIVERT */ -/* -* This strdup() is used for creating copies of network -* device names to be handed over to sysctl. -*/ - -char *net_sysctl_strdup (const char *s) -{ -char *rv =kmalloc (strlen (s)+1 ,GFP_KERNEL ); -if (rv) -strcpy (rv, s); -return rv; -} - ctl_table core_table[] = { #ifdef CONFIG_NET {
@@ -177,6 +164,4 @@ ctl_table core_table[] = { { .ctl_name = 0 } }; -EXPORT_SYMBOL (net_sysctl_strdup); -#endif
net/ipv4/devinet.c +1 -1
@@ -1438,7 +1438,7 @@ static void devinet_sysctl_register(stru* by sysctl and we wouldn't want anyone to change it under our feet * (see SIOCSIFNAME). */ - dev_name =net_sysctl_strdup (dev_name); + dev_name =kstrdup (dev_name,GFP_KERNEL );if (!dev_name) goto free;
net/ipv6/addrconf.c +2 -1
@@ -57,6 +57,7 @@#endif #include <linux/delay.h> #include <linux/notifier.h> +#include <linux/string.h> #include <net/sock.h> #include <net/snmp.h>
@@ -3361,7 +3362,7 @@ static void addrconf_sysctl_register(str* by sysctl and we wouldn't want anyone to change it under our feet * (see SIOCSIFNAME). */ - dev_name =net_sysctl_strdup (dev_name); + dev_name =kstrdup (dev_name,GFP_KERNEL );if (!dev_name) goto free;
net/core/neighbour.c +2 -1
@@ -32,6 +32,7 @@#include <net/sock.h> #include <linux/rtnetlink.h> #include <linux/random.h> +#include <linux/string.h> #define NEIGH_DEBUG 1
@@ -2239,7 +2240,7 @@ int neigh_sysctl_register(struct net_dev t->neigh_vars[15 ].data = (int *)(p +1 ) +3 ; } - dev_name =net_sysctl_strdup (dev_name_source); + dev_name =kstrdup (dev_name_source,GFP_KERNEL );if (!dev_name) { err = -ENOBUFS ; goto free;
David S. Miller
maintainerQuoted 4 lines · On Tue, 1 Feb 2005 03:28:39 +0000 "" <[email protected]> wrote:
This patch removes a strdup implmentation in the networking layer (
net_sysctl_strdup), and updates it to use the kstrdup library function.Signed-off-by Paulo Marques <[email protected]>
If kstrdup() does in, I'm fine with this change. net_sysctl_strdup() only exists because kstrdup() did not.