public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfs: use kstrdup()
@ 2008-07-19 10:16 Li Zefan
  2008-07-19 11:30 ` Pekka Enberg
  2008-07-19 13:13 ` Cyrill Gorcunov
  0 siblings, 2 replies; 20+ messages in thread
From: Li Zefan @ 2008-07-19 10:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Al Viro, LKML

This piece of code can be replaced by a kstrdup().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 fs/namespace.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 4f6f763..08c3b2d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -127,14 +127,7 @@ struct vfsmount *alloc_vfsmnt(const char *name)
 		INIT_LIST_HEAD(&mnt->mnt_slave_list);
 		INIT_LIST_HEAD(&mnt->mnt_slave);
 		atomic_set(&mnt->__mnt_writers, 0);
-		if (name) {
-			int size = strlen(name) + 1;
-			char *newname = kmalloc(size, GFP_KERNEL);
-			if (newname) {
-				memcpy(newname, name, size);
-				mnt->mnt_devname = newname;
-			}
-		}
+		mnt->mnt_devname = kstrdup(name, GFP_KERNEL);
 	}
 	return mnt;
 }
-- 
1.5.4.rc3



^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-07-21 10:17 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-19 10:16 [PATCH] vfs: use kstrdup() Li Zefan
2008-07-19 11:30 ` Pekka Enberg
2008-07-19 13:13 ` Cyrill Gorcunov
2008-07-19 13:19   ` Cyrill Gorcunov
2008-07-21  5:27     ` Al Viro
2008-07-21  6:29       ` Li Zefan
2008-07-21  7:03         ` Al Viro
2008-07-21  7:09           ` Cyrill Gorcunov
2008-07-21  8:04           ` Cyrill Gorcunov
2008-07-21  8:28             ` Li Zefan
2008-07-21  8:44               ` Cyrill Gorcunov
2008-07-21  8:59                 ` Li Zefan
2008-07-21  9:06                   ` Pekka Enberg
2008-07-21 10:05                     ` Cyrill Gorcunov
2008-07-21 10:10                       ` Li Zefan
2008-07-21 10:17                         ` Cyrill Gorcunov
2008-07-21  9:12                   ` Al Viro
2008-07-21  8:28             ` Al Viro
2008-07-21  8:35               ` Cyrill Gorcunov
2008-07-21  8:42               ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox