Remove gfp argument from kstrdup()
Subsystems (14)
PATCH 1/1 Remove gfp argument from kstrdup()
All kstrdup() callers use GFP_KERNEL flag so this parameter seems to be useless.
---
arch/um/kernel/process_kern.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- drivers/md/dm-ioctl.c | 6 +++--- drivers/parport/probe.c | 10 +++++----- include/linux/fsnotify.h | 2 +- include/linux/string.h | 2 +- kernel/module.c | 2 +- mm/slab.c | 5 ++--- net/core/neighbour.c | 2 +- net/ipv4/devinet.c | 2 +- net/ipv6/addrconf.c | 2 +- net/sunrpc/svcauth_unix.c | 2 +- security/selinux/hooks.c | 2 +- sound/core/info.c | 2 +- sound/core/info_oss.c | 2 +- sound/core/oss/mixer_oss.c | 2 +- sound/core/oss/pcm_oss.c | 2 +- sound/core/timer.c | 2 +- sound/isa/gus/gus_mem.c | 6 +++--- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_realtek.c | 2 +- sound/pci/hda/patch_sigmatel.c | 2 +- sound/synth/emux/emux.c | 2 +- 23 files changed, 32 insertions(+), 33 deletions(-)
e61add31c2fa0ff747154d61424eb4a098b64827
arch/um/kernel/process_kern.c +1 -1
@@ -341,7 +341,7 @@ void do_uml_exitcalls(void)char *uml_strdup (char *string) { -return kstrdup (string,GFP_KERNEL ); +return kstrdup (string); }int copy_to_user_proc (void __user *to,void *from,int size)
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
@@ -1323,7 +1323,7 @@ static int srp_parse_options(const charint ret = -EINVAL ;int i; - options =kstrdup (buf,GFP_KERNEL ); + options =kstrdup (buf);if (!options)return -ENOMEM ;
drivers/md/dm-ioctl.c +3 -3
@@ -131,7 +131,7 @@ static struct hash_cell *alloc_cell(consif (!hc)return NULL ; - hc->name =kstrdup (name,GFP_KERNEL ); + hc->name =kstrdup (name);if (!hc->name) {kfree (hc);return NULL ;
@@ -141,7 +141,7 @@ static struct hash_cell *alloc_cell(cons hc->uuid =NULL ; else { - hc->uuid =kstrdup (uuid,GFP_KERNEL ); + hc->uuid =kstrdup (uuid);if (!hc->uuid) {kfree (hc->name);kfree (hc);
@@ -274,7 +274,7 @@ static int dm_hash_rename(const char *ol/* * duplicate new. */ - new_name =kstrdup (new,GFP_KERNEL ); + new_name =kstrdup (new);if (!new_name)return -ENOMEM ;
drivers/parport/probe.c +5 -5
@@ -79,15 +79,15 @@ static void parse_data(struct parport *p }if (!strcmp (p,"MFG" ) || !strcmp (p,"MANUFACTURER" )) {kfree (info->mfr); - info->mfr =kstrdup (sep,GFP_KERNEL ); + info->mfr =kstrdup (sep); }else if (!strcmp (p,"MDL" ) || !strcmp (p,"MODEL" )) {kfree (info->model); - info->model =kstrdup (sep,GFP_KERNEL ); + info->model =kstrdup (sep); }else if (!strcmp (p,"CLS" ) || !strcmp (p,"CLASS" )) {int i;kfree (info->class_name); - info->class_name =kstrdup (sep,GFP_KERNEL ); + info->class_name =kstrdup (sep);for (u = sep; *u; u++) *u =toupper (*u);for (i =0 ; classes[i].token; i++) {
@@ -101,14 +101,14 @@ static void parse_data(struct parport *p }else if (!strcmp (p,"CMD" ) || !strcmp (p,"COMMAND SET" )) {kfree (info->cmdset); - info->cmdset =kstrdup (sep,GFP_KERNEL ); + info->cmdset =kstrdup (sep);/* if it speaks printer language, it's probably a printer */ if (strstr (sep,"PJL" ) ||strstr (sep,"PCL" )) guessed_class =PARPORT_CLASS_PRINTER ; }else if (!strcmp (p,"DES" ) || !strcmp (p,"DESCRIPTION" )) {kfree (info->description); - info->description =kstrdup (sep,GFP_KERNEL ); + info->description =kstrdup (sep); } } rock_on:
include/linux/fsnotify.h +1 -1
@@ -222,7 +222,7 @@ static inline void fsnotify_change(struc*/ static inline const char *fsnotify_oldname_init (const char *name) { -return kstrdup (name,GFP_KERNEL ); +return kstrdup (name); }/*
include/linux/string.h +1 -1
@@ -88,7 +88,7 @@ extern int memcmp(const void *,const voiextern void *memchr (const void *,int ,__kernel_size_t );#endif -extern char *kstrdup (const char *s,gfp_t gfp); +extern char *kstrdup (const char *s); #ifdef __cplusplus }
kernel/module.c +1 -1
@@ -382,7 +382,7 @@ static inline void percpu_modcopy(void *#define MODINFO_ATTR (field) \ static void setup_modinfo_##field(struct module *mod, const char *s) \ { \ - mod->field = kstrdup(s, GFP_KERNEL); \ + mod->field = kstrdup(s); \ } \ static ssize_t show_modinfo_##field(struct module_attribute *mattr, \ struct module *mod, char *buffer) \
mm/slab.c +2 -3
@@ -3615,9 +3615,8 @@ unsigned int ksize(const void *objp)* kstrdup - allocate space for and copy an existing string * * @s: the string to duplicate -* @gfp: the GFP mask used in the kmalloc() call when allocating memory */ -char *kstrdup (const char *s,gfp_t gfp) +char *kstrdup (const char *s) {size_t len;char *buf;
@@ -3626,7 +3625,7 @@ char *kstrdup(const char *s, gfp_t gfp)return NULL ; len =strlen (s) +1 ; - buf =kmalloc (len, gfp); + buf =kmalloc (len,GFP_KERNEL );if (buf)memcpy (buf, s, len);return buf;
net/core/neighbour.c +1 -1
@@ -2588,7 +2588,7 @@ int neigh_sysctl_register(struct net_dev t->neigh_vars[17 ].extra1 = dev; } - dev_name =kstrdup (dev_name_source,GFP_KERNEL ); + dev_name =kstrdup (dev_name_source);if (!dev_name) { err = -ENOBUFS ; goto free;
net/ipv4/devinet.c +1 -1
@@ -1492,7 +1492,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 =kstrdup (dev_name,GFP_KERNEL ); + dev_name =kstrdup (dev_name);if (!dev_name) goto free;
net/ipv6/addrconf.c +1 -1
@@ -3664,7 +3664,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 =kstrdup (dev_name,GFP_KERNEL ); + dev_name =kstrdup (dev_name);if (!dev_name) goto free;
net/sunrpc/svcauth_unix.c +1 -1
@@ -48,7 +48,7 @@ struct auth_domain *unix_domain_find(chaif (new ==NULL )return NULL ;cache_init (&new->h.h); - new->h.name =kstrdup (name,GFP_KERNEL ); + new->h.name =kstrdup (name); new->h.flavour =RPC_AUTH_UNIX ; new->addr_changes =0 ; new->h.h.expiry_time =NEVER ;
security/selinux/hooks.c +1 -1
@@ -1991,7 +1991,7 @@ static int selinux_inode_init_security(sreturn -EOPNOTSUPP ;if (name) { - namep =kstrdup (XATTR_SELINUX_SUFFIX ,GFP_KERNEL ); + namep =kstrdup (XATTR_SELINUX_SUFFIX );if (!namep)return -ENOMEM ; *name = namep;
sound/core/info.c +1 -1
@@ -751,7 +751,7 @@ static struct snd_info_entry *snd_info_c entry =kzalloc (sizeof (*entry),GFP_KERNEL );if (entry ==NULL )return NULL ; - entry->name =kstrdup (name,GFP_KERNEL ); + entry->name =kstrdup (name);if (entry->name ==NULL ) {kfree (entry);return NULL ;
sound/core/info_oss.c +1 -1
@@ -52,7 +52,7 @@ int snd_oss_info_register(int dev, int n x =NULL ; } }else { - x =kstrdup (string,GFP_KERNEL ); + x =kstrdup (string);if (x ==NULL ) {up (&strings);return -ENOMEM ;
sound/core/oss/mixer_oss.c +1 -1
@@ -1157,7 +1157,7 @@ static void snd_mixer_oss_proc_write(str goto __unlock; } tbl->oss_id = ch; - tbl->name =kstrdup (str,GFP_KERNEL ); + tbl->name =kstrdup (str);if (! tbl->name) {kfree (tbl); goto __unlock;
sound/core/oss/pcm_oss.c +1 -1
@@ -2373,7 +2373,7 @@ static void snd_pcm_oss_proc_write(strucfor (setup1 = pstr->oss.setup_list; setup1->next; setup1 = setup1->next); setup1->next = setup; } - template.task_name =kstrdup (task_name,GFP_KERNEL ); + template.task_name =kstrdup (task_name); }else { buffer->error = -ENOMEM ; }
sound/core/timer.c +1 -1
@@ -102,7 +102,7 @@ static struct snd_timer_instance *snd_ti timeri =kzalloc (sizeof (*timeri),GFP_KERNEL );if (timeri ==NULL )return NULL ; - timeri->owner =kstrdup (owner,GFP_KERNEL ); + timeri->owner =kstrdup (owner);if (! timeri->owner) {kfree (timeri);return NULL ;
sound/isa/gus/gus_mem.c +3 -3
@@ -214,7 +214,7 @@ struct snd_gf1_mem_block *snd_gf1_mem_alif (share_id !=NULL )memcpy (&block.share_id, share_id,sizeof (block.share_id)); block.owner = owner; - block.name =kstrdup (name,GFP_KERNEL ); + block.name =kstrdup (name); nblock =snd_gf1_mem_xalloc (alloc, &block);snd_gf1_mem_lock (alloc,1 );return nblock;
@@ -254,13 +254,13 @@ int snd_gf1_mem_init(struct snd_gus_cardif (gus->gf1.enh_mode) { block.ptr =0 ; block.size =1024 ; - block.name =kstrdup ("InterWave LFOs" ,GFP_KERNEL ); + block.name =kstrdup ("InterWave LFOs" );if (snd_gf1_mem_xalloc (alloc, &block) ==NULL )return -ENOMEM ; } block.ptr = gus->gf1.default_voice_address; block.size =4 ; - block.name =kstrdup ("Voice default (NULL's)" ,GFP_KERNEL ); + block.name =kstrdup ("Voice default (NULL's)" );if (snd_gf1_mem_xalloc (alloc, &block) ==NULL )return -ENOMEM ;#ifdef CONFIG_SND_DEBUG
sound/pci/hda/patch_analog.c +1 -1
@@ -1637,7 +1637,7 @@ static int add_control(struct ad198x_spe knew = &spec->kctl_alloc[spec->num_kctl_used]; *knew = ad1988_control_templates[type]; - knew->name =kstrdup (name,GFP_KERNEL ); + knew->name =kstrdup (name);if (! knew->name)return -ENOMEM ; knew->private_value = val;
sound/pci/hda/patch_realtek.c +1 -1
@@ -1931,7 +1931,7 @@ static int add_control(struct alc_spec * knew = &spec->kctl_alloc[spec->num_kctl_used]; *knew = alc880_control_templates[type]; - knew->name =kstrdup (name,GFP_KERNEL ); + knew->name =kstrdup (name);if (! knew->name)return -ENOMEM ; knew->private_value = val;
sound/pci/hda/patch_sigmatel.c +1 -1
@@ -535,7 +535,7 @@ static int stac92xx_add_control(struct s knew = &spec->kctl_alloc[spec->num_kctl_used]; *knew = stac92xx_control_templates[type]; - knew->name =kstrdup (name,GFP_KERNEL ); + knew->name =kstrdup (name);if (! knew->name)return -ENOMEM ; knew->private_value = val;
sound/synth/emux/emux.c +1 -1
@@ -100,7 +100,7 @@ int snd_emux_register(struct snd_emux *esnd_assert (name !=NULL , return -EINVAL ); emu->card = card; - emu->name =kstrdup (name,GFP_KERNEL ); + emu->name =kstrdup (name); emu->voices =kcalloc (emu->max_voices,sizeof (struct snd_emux_voice ),GFP_KERNEL );if (emu->voices ==NULL )
Signature · 1 line
1.0.6
Quoted 2 lines · Timo Hirvonen
All
kstrdup()callers useGFP_KERNELflag so this parameter seems to be useless.
Please don't. You're making the API inconsistent and forcing everyone to use GFP_KERNEL for little or no benefit.
Pekka
Quoted 6 lines · On Fri, 6 Jan 2006 13:51:41 +0200 Pekka Enberg <[email protected]> wrote:
Quoted 2 lines · Timo Hirvonen
All
kstrdup()callers useGFP_KERNELflag so this parameter seems to be useless.Please don't. You're making the API inconsistent and forcing everyone to use
GFP_KERNELfor little or no benefit.
I don't see why any other GFP_* flag could be useful for strings.
Signature · 1 line
http://onion.dynserv.net/~timo/
Quoted 11 lines · Timo Hirvonen
Quoted 6 lines · On Fri, 6 Jan 2006 13:51:41 +0200 Pekka Enberg <[email protected]> wrote:
Quoted 2 lines · Timo Hirvonen
All
kstrdup()callers useGFP_KERNELflag so this parameter seems to be useless.Please don't. You're making the API inconsistent and forcing everyone to use
GFP_KERNELfor little or no benefit.I don't see why any other GFP_* flag could be useful for strings.
I think you missed the point a bit..
the GFP_ flags aren't so much about what you allocate it, but in what circumstances you are allocating (eg inside a lock/irq or not etc)