aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-ioctl.c14
-rw-r--r--drivers/parport/probe.c18
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/string.h2
-rw-r--r--include/sound/core.h3
-rw-r--r--mm/slab.c24
-rw-r--r--net/core/neighbour.c3
-rw-r--r--net/core/sysctl_net_core.c15
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/sunrpc/svcauth_unix.c11
-rw-r--r--sound/core/info.c3
-rw-r--r--sound/core/info_oss.c3
-rw-r--r--sound/core/memory.c41
-rw-r--r--sound/core/oss/mixer_oss.c3
-rw-r--r--sound/core/oss/pcm_oss.c3
-rw-r--r--sound/core/sound.c2
-rw-r--r--sound/core/timer.c3
-rw-r--r--sound/isa/gus/gus_mem.c7
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/synth/emux/emux.c3
21 files changed, 75 insertions, 94 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index ee3c869d9701..200a0688f717 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -122,14 +122,6 @@ static struct hash_cell *__get_uuid_cell(const char *str)
122/*----------------------------------------------------------------- 122/*-----------------------------------------------------------------
123 * Inserting, removing and renaming a device. 123 * Inserting, removing and renaming a device.
124 *---------------------------------------------------------------*/ 124 *---------------------------------------------------------------*/
125static inline char *kstrdup(const char *str)
126{
127 char *r = kmalloc(strlen(str) + 1, GFP_KERNEL);
128 if (r)
129 strcpy(r, str);
130 return r;
131}
132
133static struct hash_cell *alloc_cell(const char *name, const char *uuid, 125static struct hash_cell *alloc_cell(const char *name, const char *uuid,
134 struct mapped_device *md) 126 struct mapped_device *md)
135{ 127{
@@ -139,7 +131,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
139 if (!hc) 131 if (!hc)
140 return NULL; 132 return NULL;
141 133
142 hc->name = kstrdup(name); 134 hc->name = kstrdup(name, GFP_KERNEL);
143 if (!hc->name) { 135 if (!hc->name) {
144 kfree(hc); 136 kfree(hc);
145 return NULL; 137 return NULL;
@@ -149,7 +141,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
149 hc->uuid = NULL; 141 hc->uuid = NULL;
150 142
151 else { 143 else {
152 hc->uuid = kstrdup(uuid); 144 hc->uuid = kstrdup(uuid, GFP_KERNEL);
153 if (!hc->uuid) { 145 if (!hc->uuid) {
154 kfree(hc->name); 146 kfree(hc->name);
155 kfree(hc); 147 kfree(hc);
@@ -273,7 +265,7 @@ static int dm_hash_rename(const char *old, const char *new)
273 /* 265 /*
274 * duplicate new. 266 * duplicate new.
275 */ 267 */
276 new_name = kstrdup(new); 268 new_name = kstrdup(new, GFP_KERNEL);
277 if (!new_name) 269 if (!new_name)
278 return -ENOMEM; 270 return -ENOMEM;
279 271
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index c94963145e17..6e6f42d01e64 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -48,14 +48,6 @@ static void pretty_print(struct parport *port, int device)
48 printk("\n"); 48 printk("\n");
49} 49}
50 50
51static char *strdup(char *str)
52{
53 int n = strlen(str)+1;
54 char *s = kmalloc(n, GFP_KERNEL);
55 if (!s) return NULL;
56 return strcpy(s, str);
57}
58
59static void parse_data(struct parport *port, int device, char *str) 51static void parse_data(struct parport *port, int device, char *str)
60{ 52{
61 char *txt = kmalloc(strlen(str)+1, GFP_KERNEL); 53 char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
@@ -88,16 +80,16 @@ static void parse_data(struct parport *port, int device, char *str)
88 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) { 80 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) {
89 if (info->mfr) 81 if (info->mfr)
90 kfree (info->mfr); 82 kfree (info->mfr);
91 info->mfr = strdup(sep); 83 info->mfr = kstrdup(sep, GFP_KERNEL);
92 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) { 84 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) {
93 if (info->model) 85 if (info->model)
94 kfree (info->model); 86 kfree (info->model);
95 info->model = strdup(sep); 87 info->model = kstrdup(sep, GFP_KERNEL);
96 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) { 88 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) {
97 int i; 89 int i;
98 if (info->class_name) 90 if (info->class_name)
99 kfree (info->class_name); 91 kfree (info->class_name);
100 info->class_name = strdup(sep); 92 info->class_name = kstrdup(sep, GFP_KERNEL);
101 for (u = sep; *u; u++) 93 for (u = sep; *u; u++)
102 *u = toupper(*u); 94 *u = toupper(*u);
103 for (i = 0; classes[i].token; i++) { 95 for (i = 0; classes[i].token; i++) {
@@ -112,7 +104,7 @@ static void parse_data(struct parport *port, int device, char *str)
112 !strcmp(p, "COMMAND SET")) { 104 !strcmp(p, "COMMAND SET")) {
113 if (info->cmdset) 105 if (info->cmdset)
114 kfree (info->cmdset); 106 kfree (info->cmdset);
115 info->cmdset = strdup(sep); 107 info->cmdset = kstrdup(sep, GFP_KERNEL);
116 /* if it speaks printer language, it's 108 /* if it speaks printer language, it's
117 probably a printer */ 109 probably a printer */
118 if (strstr(sep, "PJL") || strstr(sep, "PCL")) 110 if (strstr(sep, "PJL") || strstr(sep, "PCL"))
@@ -120,7 +112,7 @@ static void parse_data(struct parport *port, int device, char *str)
120 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) { 112 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) {
121 if (info->description) 113 if (info->description)
122 kfree (info->description); 114 kfree (info->description);
123 info->description = strdup(sep); 115 info->description = kstrdup(sep, GFP_KERNEL);
124 } 116 }
125 } 117 }
126 rock_on: 118 rock_on:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d6afd440cf7b..d89816ad642f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -925,10 +925,6 @@ extern int skb_checksum_help(struct sk_buff *skb, int inward);
925extern void net_enable_timestamp(void); 925extern void net_enable_timestamp(void);
926extern void net_disable_timestamp(void); 926extern void net_disable_timestamp(void);
927 927
928#ifdef CONFIG_SYSCTL
929extern char *net_sysctl_strdup(const char *s);
930#endif
931
932#endif /* __KERNEL__ */ 928#endif /* __KERNEL__ */
933 929
934#endif /* _LINUX_DEV_H */ 930#endif /* _LINUX_DEV_H */
diff --git a/include/linux/string.h b/include/linux/string.h
index b9fc59469956..93994c613095 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -88,6 +88,8 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
88extern void * memchr(const void *,int,__kernel_size_t); 88extern void * memchr(const void *,int,__kernel_size_t);
89#endif 89#endif
90 90
91extern char *kstrdup(const char *s, int gfp);
92
91#ifdef __cplusplus 93#ifdef __cplusplus
92} 94}
93#endif 95#endif
diff --git a/include/sound/core.h b/include/sound/core.h
index 9117c23e3a01..f8c4ef0aa352 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -292,6 +292,7 @@ void *snd_hidden_kcalloc(size_t n, size_t size, int flags);
292void snd_hidden_kfree(const void *obj); 292void snd_hidden_kfree(const void *obj);
293void *snd_hidden_vmalloc(unsigned long size); 293void *snd_hidden_vmalloc(unsigned long size);
294void snd_hidden_vfree(void *obj); 294void snd_hidden_vfree(void *obj);
295char *snd_hidden_kstrdup(const char *s, int flags);
295#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) 296#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
296#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) 297#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
297#define kfree(obj) snd_hidden_kfree(obj) 298#define kfree(obj) snd_hidden_kfree(obj)
@@ -301,6 +302,7 @@ void snd_hidden_vfree(void *obj);
301#define vmalloc_nocheck(size) snd_wrapper_vmalloc(size) 302#define vmalloc_nocheck(size) snd_wrapper_vmalloc(size)
302#define kfree_nocheck(obj) snd_wrapper_kfree(obj) 303#define kfree_nocheck(obj) snd_wrapper_kfree(obj)
303#define vfree_nocheck(obj) snd_wrapper_vfree(obj) 304#define vfree_nocheck(obj) snd_wrapper_vfree(obj)
305#define kstrdup(s, flags) snd_hidden_kstrdup(s, flags)
304#else 306#else
305#define snd_memory_init() /*NOP*/ 307#define snd_memory_init() /*NOP*/
306#define snd_memory_done() /*NOP*/ 308#define snd_memory_done() /*NOP*/
@@ -311,7 +313,6 @@ void snd_hidden_vfree(void *obj);
311#define kfree_nocheck(obj) kfree(obj) 313#define kfree_nocheck(obj) kfree(obj)
312#define vfree_nocheck(obj) vfree(obj) 314#define vfree_nocheck(obj) vfree(obj)
313#endif 315#endif
314char *snd_kmalloc_strdup(const char *string, int flags);
315int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); 316int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count);
316int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); 317int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count);
317 318
diff --git a/mm/slab.c b/mm/slab.c
index 93cbbbb39f42..122d031baab2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -92,6 +92,7 @@
92#include <linux/sysctl.h> 92#include <linux/sysctl.h>
93#include <linux/module.h> 93#include <linux/module.h>
94#include <linux/rcupdate.h> 94#include <linux/rcupdate.h>
95#include <linux/string.h>
95 96
96#include <asm/uaccess.h> 97#include <asm/uaccess.h>
97#include <asm/cacheflush.h> 98#include <asm/cacheflush.h>
@@ -3082,3 +3083,26 @@ unsigned int ksize(const void *objp)
3082 3083
3083 return size; 3084 return size;
3084} 3085}
3086
3087
3088/*
3089 * kstrdup - allocate space for and copy an existing string
3090 *
3091 * @s: the string to duplicate
3092 * @gfp: the GFP mask used in the kmalloc() call when allocating memory
3093 */
3094char *kstrdup(const char *s, int gfp)
3095{
3096 size_t len;
3097 char *buf;
3098
3099 if (!s)
3100 return NULL;
3101
3102 len = strlen(s) + 1;
3103 buf = kmalloc(len, gfp);
3104 if (buf)
3105 memcpy(buf, s, len);
3106 return buf;
3107}
3108EXPORT_SYMBOL(kstrdup);
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
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 650dcb12d9a1..d8a10e3dd77d 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1471,7 +1471,7 @@ static void devinet_sysctl_register(struct in_device *in_dev,
1471 * by sysctl and we wouldn't want anyone to change it under our feet 1471 * by sysctl and we wouldn't want anyone to change it under our feet
1472 * (see SIOCSIFNAME). 1472 * (see SIOCSIFNAME).
1473 */ 1473 */
1474 dev_name = net_sysctl_strdup(dev_name); 1474 dev_name = kstrdup(dev_name, GFP_KERNEL);
1475 if (!dev_name) 1475 if (!dev_name)
1476 goto free; 1476 goto free;
1477 1477
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 14f5c53235fe..a54d4ef3fd35 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -57,6 +57,7 @@
57#endif 57#endif
58#include <linux/delay.h> 58#include <linux/delay.h>
59#include <linux/notifier.h> 59#include <linux/notifier.h>
60#include <linux/string.h>
60 61
61#include <net/sock.h> 62#include <net/sock.h>
62#include <net/snmp.h> 63#include <net/snmp.h>
@@ -3437,7 +3438,7 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
3437 * by sysctl and we wouldn't want anyone to change it under our feet 3438 * by sysctl and we wouldn't want anyone to change it under our feet
3438 * (see SIOCSIFNAME). 3439 * (see SIOCSIFNAME).
3439 */ 3440 */
3440 dev_name = net_sysctl_strdup(dev_name); 3441 dev_name = kstrdup(dev_name, GFP_KERNEL);
3441 if (!dev_name) 3442 if (!dev_name)
3442 goto free; 3443 goto free;
3443 3444
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 2b99b4028d31..d6baf6fdf8a9 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -8,6 +8,7 @@
8#include <linux/err.h> 8#include <linux/err.h>
9#include <linux/seq_file.h> 9#include <linux/seq_file.h>
10#include <linux/hash.h> 10#include <linux/hash.h>
11#include <linux/string.h>
11 12
12#define RPCDBG_FACILITY RPCDBG_AUTH 13#define RPCDBG_FACILITY RPCDBG_AUTH
13 14
@@ -20,14 +21,6 @@
20 */ 21 */
21 22
22 23
23static char *strdup(char *s)
24{
25 char *rv = kmalloc(strlen(s)+1, GFP_KERNEL);
26 if (rv)
27 strcpy(rv, s);
28 return rv;
29}
30
31struct unix_domain { 24struct unix_domain {
32 struct auth_domain h; 25 struct auth_domain h;
33 int addr_changes; 26 int addr_changes;
@@ -55,7 +48,7 @@ struct auth_domain *unix_domain_find(char *name)
55 if (new == NULL) 48 if (new == NULL)
56 return NULL; 49 return NULL;
57 cache_init(&new->h.h); 50 cache_init(&new->h.h);
58 new->h.name = strdup(name); 51 new->h.name = kstrdup(name, GFP_KERNEL);
59 new->h.flavour = RPC_AUTH_UNIX; 52 new->h.flavour = RPC_AUTH_UNIX;
60 new->addr_changes = 0; 53 new->addr_changes = 0;
61 new->h.h.expiry_time = NEVER; 54 new->h.h.expiry_time = NEVER;
diff --git a/sound/core/info.c b/sound/core/info.c
index 31faffe01cb0..5e122bbe7c92 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -24,6 +24,7 @@
24#include <linux/vmalloc.h> 24#include <linux/vmalloc.h>
25#include <linux/time.h> 25#include <linux/time.h>
26#include <linux/smp_lock.h> 26#include <linux/smp_lock.h>
27#include <linux/string.h>
27#include <sound/core.h> 28#include <sound/core.h>
28#include <sound/minors.h> 29#include <sound/minors.h>
29#include <sound/info.h> 30#include <sound/info.h>
@@ -754,7 +755,7 @@ static snd_info_entry_t *snd_info_create_entry(const char *name)
754 entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); 755 entry = kcalloc(1, sizeof(*entry), GFP_KERNEL);
755 if (entry == NULL) 756 if (entry == NULL)
756 return NULL; 757 return NULL;
757 entry->name = snd_kmalloc_strdup(name, GFP_KERNEL); 758 entry->name = kstrdup(name, GFP_KERNEL);
758 if (entry->name == NULL) { 759 if (entry->name == NULL) {
759 kfree(entry); 760 kfree(entry);
760 return NULL; 761 return NULL;
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c
index f9e4ce443454..12107968d402 100644
--- a/sound/core/info_oss.c
+++ b/sound/core/info_oss.c
@@ -22,6 +22,7 @@
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/time.h> 24#include <linux/time.h>
25#include <linux/string.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/minors.h> 27#include <sound/minors.h>
27#include <sound/info.h> 28#include <sound/info.h>
@@ -51,7 +52,7 @@ int snd_oss_info_register(int dev, int num, char *string)
51 x = NULL; 52 x = NULL;
52 } 53 }
53 } else { 54 } else {
54 x = snd_kmalloc_strdup(string, GFP_KERNEL); 55 x = kstrdup(string, GFP_KERNEL);
55 if (x == NULL) { 56 if (x == NULL) {
56 up(&strings); 57 up(&strings);
57 return -ENOMEM; 58 return -ENOMEM;
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 20860fec9364..c1fb28e84330 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -184,6 +184,20 @@ void snd_hidden_vfree(void *obj)
184 snd_wrapper_vfree(obj); 184 snd_wrapper_vfree(obj);
185} 185}
186 186
187char *snd_hidden_kstrdup(const char *s, int flags)
188{
189 int len;
190 char *buf;
191
192 if (!s) return NULL;
193
194 len = strlen(s) + 1;
195 buf = _snd_kmalloc(len, flags);
196 if (buf)
197 memcpy(buf, s, len);
198 return buf;
199}
200
187static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 201static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
188{ 202{
189 snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc); 203 snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc);
@@ -214,36 +228,9 @@ int __exit snd_memory_info_done(void)
214 return 0; 228 return 0;
215} 229}
216 230
217#else
218
219#define _snd_kmalloc kmalloc
220
221#endif /* CONFIG_SND_DEBUG_MEMORY */ 231#endif /* CONFIG_SND_DEBUG_MEMORY */
222 232
223/** 233/**
224 * snd_kmalloc_strdup - copy the string
225 * @string: the original string
226 * @flags: allocation conditions, GFP_XXX
227 *
228 * Allocates a memory chunk via kmalloc() and copies the string to it.
229 *
230 * Returns the pointer, or NULL if no enoguh memory.
231 */
232char *snd_kmalloc_strdup(const char *string, int flags)
233{
234 size_t len;
235 char *ptr;
236
237 if (!string)
238 return NULL;
239 len = strlen(string) + 1;
240 ptr = _snd_kmalloc(len, flags);
241 if (ptr)
242 memcpy(ptr, string, len);
243 return ptr;
244}
245
246/**
247 * copy_to_user_fromio - copy data from mmio-space to user-space 234 * copy_to_user_fromio - copy data from mmio-space to user-space
248 * @dst: the destination pointer on user-space 235 * @dst: the destination pointer on user-space
249 * @src: the source pointer on mmio 236 * @src: the source pointer on mmio
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 98ed9a9f0da6..98fc0766f885 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -24,6 +24,7 @@
24#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/string.h>
27#include <sound/core.h> 28#include <sound/core.h>
28#include <sound/minors.h> 29#include <sound/minors.h>
29#include <sound/control.h> 30#include <sound/control.h>
@@ -1137,7 +1138,7 @@ static void snd_mixer_oss_proc_write(snd_info_entry_t *entry,
1137 goto __unlock; 1138 goto __unlock;
1138 } 1139 }
1139 tbl->oss_id = ch; 1140 tbl->oss_id = ch;
1140 tbl->name = snd_kmalloc_strdup(str, GFP_KERNEL); 1141 tbl->name = kstrdup(str, GFP_KERNEL);
1141 if (! tbl->name) { 1142 if (! tbl->name) {
1142 kfree(tbl); 1143 kfree(tbl);
1143 goto __unlock; 1144 goto __unlock;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index cab30977e7c0..de7444c586f9 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -33,6 +33,7 @@
33#include <linux/time.h> 33#include <linux/time.h>
34#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/string.h>
36#include <sound/core.h> 37#include <sound/core.h>
37#include <sound/minors.h> 38#include <sound/minors.h>
38#include <sound/pcm.h> 39#include <sound/pcm.h>
@@ -2360,7 +2361,7 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
2360 for (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next); 2361 for (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next);
2361 setup1->next = setup; 2362 setup1->next = setup;
2362 } 2363 }
2363 template.task_name = snd_kmalloc_strdup(task_name, GFP_KERNEL); 2364 template.task_name = kstrdup(task_name, GFP_KERNEL);
2364 } else { 2365 } else {
2365 buffer->error = -ENOMEM; 2366 buffer->error = -ENOMEM;
2366 } 2367 }
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 0815fadeb3ec..7612884f530b 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -399,8 +399,8 @@ EXPORT_SYMBOL(snd_hidden_kcalloc);
399EXPORT_SYMBOL(snd_hidden_kfree); 399EXPORT_SYMBOL(snd_hidden_kfree);
400EXPORT_SYMBOL(snd_hidden_vmalloc); 400EXPORT_SYMBOL(snd_hidden_vmalloc);
401EXPORT_SYMBOL(snd_hidden_vfree); 401EXPORT_SYMBOL(snd_hidden_vfree);
402EXPORT_SYMBOL(snd_hidden_kstrdup);
402#endif 403#endif
403EXPORT_SYMBOL(snd_kmalloc_strdup);
404EXPORT_SYMBOL(copy_to_user_fromio); 404EXPORT_SYMBOL(copy_to_user_fromio);
405EXPORT_SYMBOL(copy_from_user_toio); 405EXPORT_SYMBOL(copy_from_user_toio);
406 /* init.c */ 406 /* init.c */
diff --git a/sound/core/timer.c b/sound/core/timer.c
index b498e5482d77..cfaccd415b3b 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -26,6 +26,7 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
29#include <linux/string.h>
29#include <sound/core.h> 30#include <sound/core.h>
30#include <sound/timer.h> 31#include <sound/timer.h>
31#include <sound/control.h> 32#include <sound/control.h>
@@ -100,7 +101,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti
100 timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); 101 timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL);
101 if (timeri == NULL) 102 if (timeri == NULL)
102 return NULL; 103 return NULL;
103 timeri->owner = snd_kmalloc_strdup(owner, GFP_KERNEL); 104 timeri->owner = kstrdup(owner, GFP_KERNEL);
104 if (! timeri->owner) { 105 if (! timeri->owner) {
105 kfree(timeri); 106 kfree(timeri);
106 return NULL; 107 return NULL;
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 609838e8ef67..5eb766dd564b 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -21,6 +21,7 @@
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/string.h>
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/gus.h> 26#include <sound/gus.h>
26#include <sound/info.h> 27#include <sound/info.h>
@@ -213,7 +214,7 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner,
213 if (share_id != NULL) 214 if (share_id != NULL)
214 memcpy(&block.share_id, share_id, sizeof(block.share_id)); 215 memcpy(&block.share_id, share_id, sizeof(block.share_id));
215 block.owner = owner; 216 block.owner = owner;
216 block.name = snd_kmalloc_strdup(name, GFP_KERNEL); 217 block.name = kstrdup(name, GFP_KERNEL);
217 nblock = snd_gf1_mem_xalloc(alloc, &block); 218 nblock = snd_gf1_mem_xalloc(alloc, &block);
218 snd_gf1_mem_lock(alloc, 1); 219 snd_gf1_mem_lock(alloc, 1);
219 return nblock; 220 return nblock;
@@ -253,13 +254,13 @@ int snd_gf1_mem_init(snd_gus_card_t * gus)
253 if (gus->gf1.enh_mode) { 254 if (gus->gf1.enh_mode) {
254 block.ptr = 0; 255 block.ptr = 0;
255 block.size = 1024; 256 block.size = 1024;
256 block.name = snd_kmalloc_strdup("InterWave LFOs", GFP_KERNEL); 257 block.name = kstrdup("InterWave LFOs", GFP_KERNEL);
257 if (snd_gf1_mem_xalloc(alloc, &block) == NULL) 258 if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
258 return -ENOMEM; 259 return -ENOMEM;
259 } 260 }
260 block.ptr = gus->gf1.default_voice_address; 261 block.ptr = gus->gf1.default_voice_address;
261 block.size = 4; 262 block.size = 4;
262 block.name = snd_kmalloc_strdup("Voice default (NULL's)", GFP_KERNEL); 263 block.name = kstrdup("Voice default (NULL's)", GFP_KERNEL);
263 if (snd_gf1_mem_xalloc(alloc, &block) == NULL) 264 if (snd_gf1_mem_xalloc(alloc, &block) == NULL)
264 return -ENOMEM; 265 return -ENOMEM;
265#ifdef CONFIG_SND_DEBUG 266#ifdef CONFIG_SND_DEBUG
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9edd558d6bd3..bab89843d850 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1781,7 +1781,7 @@ static int add_control(struct alc_spec *spec, int type, const char *name, unsign
1781 1781
1782 knew = &spec->kctl_alloc[spec->num_kctl_used]; 1782 knew = &spec->kctl_alloc[spec->num_kctl_used];
1783 *knew = alc880_control_templates[type]; 1783 *knew = alc880_control_templates[type];
1784 knew->name = snd_kmalloc_strdup(name, GFP_KERNEL); 1784 knew->name = kstrdup(name, GFP_KERNEL);
1785 if (! knew->name) 1785 if (! knew->name)
1786 return -ENOMEM; 1786 return -ENOMEM;
1787 knew->private_value = val; 1787 knew->private_value = val;
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 16f3b461627a..60d0b2c66698 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -22,6 +22,7 @@
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/string.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/emux_synth.h> 27#include <sound/emux_synth.h>
27#include <linux/init.h> 28#include <linux/init.h>
@@ -76,7 +77,7 @@ int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name)
76 snd_assert(name != NULL, return -EINVAL); 77 snd_assert(name != NULL, return -EINVAL);
77 78
78 emu->card = card; 79 emu->card = card;
79 emu->name = snd_kmalloc_strdup(name, GFP_KERNEL); 80 emu->name = kstrdup(name, GFP_KERNEL);
80 emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL); 81 emu->voices = kcalloc(emu->max_voices, sizeof(snd_emux_voice_t), GFP_KERNEL);
81 if (emu->voices == NULL) 82 if (emu->voices == NULL)
82 return -ENOMEM; 83 return -ENOMEM;