mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/3] user.c: use kmem_cache_zalloc()
@ 2007-09-21  9:39 Alexey Dobriyan
  2007-09-21 19:34 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2007-09-21  9:39 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, devel

Quite a few fields are zeroed during user_struct creation, so use
kmem_cache_zalloc() --  save a few lines and #ifdef. Also will help avoid
 #ifdef CONFIG_POSIX_MQUEUE in next patch.

Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
---

 kernel/user.c |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

--- a/kernel/user.c
+++ b/kernel/user.c
@@ -129,21 +129,11 @@ struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid)
 	if (!up) {
 		struct user_struct *new;
 
-		new = kmem_cache_alloc(uid_cachep, GFP_KERNEL);
+		new = kmem_cache_zalloc(uid_cachep, GFP_KERNEL);
 		if (!new)
 			return NULL;
 		new->uid = uid;
 		atomic_set(&new->__count, 1);
-		atomic_set(&new->processes, 0);
-		atomic_set(&new->files, 0);
-		atomic_set(&new->sigpending, 0);
-#ifdef CONFIG_INOTIFY_USER
-		atomic_set(&new->inotify_watches, 0);
-		atomic_set(&new->inotify_devs, 0);
-#endif
-
-		new->mq_bytes = 0;
-		new->locked_shm = 0;
 
 		if (alloc_uid_keyring(new, current) < 0) {
 			kmem_cache_free(uid_cachep, new);


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

end of thread, other threads:[~2007-09-22  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-21  9:39 [PATCH 2/3] user.c: use kmem_cache_zalloc() Alexey Dobriyan
2007-09-21 19:34 ` Andrew Morton
2007-09-22  4:33   ` Satyam Sharma

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

all inboxes | Powered by JetHome®