[PATCH 2.6] 6/7 replace net_sysctl_strdup by kstrdup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pmarques@xxxxxxxxxxxx>

--
Paulo Marques - www.grupopie.com
 
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke (1729 - 1797)
diff -uprN -X dontdiff vanilla-2.6.11-rc2-bk9/include/linux/netdevice.h linux-2.6.11-rc2-bk9/include/linux/netdevice.h
--- vanilla-2.6.11-rc2-bk9/include/linux/netdevice.h	2005-01-31 20:05:37.000000000 +0000
+++ linux-2.6.11-rc2-bk9/include/linux/netdevice.h	2005-01-31 23:52:04.000000000 +0000
@@ -929,10 +929,6 @@ extern int skb_checksum_help(struct sk_b
 extern 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 */
diff -uprN -X dontdiff vanilla-2.6.11-rc2-bk9/net/core/sysctl_net_core.c linux-2.6.11-rc2-bk9/net/core/sysctl_net_core.c
--- vanilla-2.6.11-rc2-bk9/net/core/sysctl_net_core.c	2004-12-24 21:34:31.000000000 +0000
+++ linux-2.6.11-rc2-bk9/net/core/sysctl_net_core.c	2005-01-31 23:53:05.000000000 +0000
@@ -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
diff -uprN -X dontdiff vanilla-2.6.11-rc2-bk9/net/ipv4/devinet.c linux-2.6.11-rc2-bk9/net/ipv4/devinet.c
--- vanilla-2.6.11-rc2-bk9/net/ipv4/devinet.c	2005-01-31 20:05:34.000000000 +0000
+++ linux-2.6.11-rc2-bk9/net/ipv4/devinet.c	2005-01-31 23:58:35.000000000 +0000
@@ -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;
 
diff -uprN -X dontdiff vanilla-2.6.11-rc2-bk9/net/ipv6/addrconf.c linux-2.6.11-rc2-bk9/net/ipv6/addrconf.c
--- vanilla-2.6.11-rc2-bk9/net/ipv6/addrconf.c	2005-01-31 20:05:34.000000000 +0000
+++ linux-2.6.11-rc2-bk9/net/ipv6/addrconf.c	2005-01-31 23:58:56.000000000 +0000
@@ -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;

diff -uprN -X dontdiff vanilla-2.6.11-rc2-bk9/net/core/neighbour.c linux-2.6.11-rc2-bk9/net/core/neighbour.c
--- vanilla-2.6.11-rc2-bk9/net/core/neighbour.c	2005-01-31 20:05:37.000000000 +0000
+++ linux-2.6.11-rc2-bk9/net/core/neighbour.c	2005-02-01 02:09:26.975638604 +0000
@@ -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;

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux