aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPaulo Marques <pmarques@grupopie.com>2005-06-23 03:09:02 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:18 -0400
commit543537bd922692bc978e2e356fcd8bfc9c2ee7d5 (patch)
tree0089e3907e7d6c17c01cffc6ea4a8962ed053079 /net/core
parent991114c6fa6a21d1fa4d544abe78592352860c82 (diff)
[PATCH] create a kstrdup library function
This patch creates a new kstrdup library function and changes the "local" implementations in several places to use this function. Most of the changes come from the sound and net subsystems. The sound part had already been acknowledged by Takashi Iwai and the net part by David S. Miller. I left UML alone for now because I would need more time to read the code carefully before making changes there. Signed-off-by: Paulo Marques <pmarques@grupopie.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/neighbour.c3
-rw-r--r--net/core/sysctl_net_core.c15
2 files changed, 2 insertions, 16 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f6bdcad47da6..851eb927ed97 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -32,6 +32,7 @@
32#include <net/sock.h> 32#include <net/sock.h>
33#include <linux/rtnetlink.h> 33#include <linux/rtnetlink.h>
34#include <linux/random.h> 34#include <linux/random.h>
35#include <linux/string.h>
35 36
36#define NEIGH_DEBUG 1 37#define NEIGH_DEBUG 1
37 38
@@ -2592,7 +2593,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2592 t->neigh_vars[17].extra1 = dev; 2593 t->neigh_vars[17].extra1 = dev;
2593 } 2594 }
2594 2595
2595 dev_name = net_sysctl_strdup(dev_name_source); 2596 dev_name = kstrdup(dev_name_source, GFP_KERNEL);
2596 if (!dev_name) { 2597 if (!dev_name) {
2597 err = -ENOBUFS; 2598 err = -ENOBUFS;
2598 goto free; 2599 goto free;
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index c8be646cb191..880a88815211 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -35,19 +35,6 @@ extern int sysctl_somaxconn;
35extern char sysctl_divert_version[]; 35extern char sysctl_divert_version[];
36#endif /* CONFIG_NET_DIVERT */ 36#endif /* CONFIG_NET_DIVERT */
37 37
38/*
39 * This strdup() is used for creating copies of network
40 * device names to be handed over to sysctl.
41 */
42
43char *net_sysctl_strdup(const char *s)
44{
45 char *rv = kmalloc(strlen(s)+1, GFP_KERNEL);
46 if (rv)
47 strcpy(rv, s);
48 return rv;
49}
50
51ctl_table core_table[] = { 38ctl_table core_table[] = {
52#ifdef CONFIG_NET 39#ifdef CONFIG_NET
53 { 40 {
@@ -177,6 +164,4 @@ ctl_table core_table[] = {
177 { .ctl_name = 0 } 164 { .ctl_name = 0 }
178}; 165};
179 166
180EXPORT_SYMBOL(net_sysctl_strdup);
181
182#endif 167#endif