LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* On spreading atomic_t initialization
@ 2008-10-28 15:29 Alexey Dobriyan
  2008-10-28 15:54 ` Matthew Wilcox
  2008-10-28 16:16 ` Linus Torvalds
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2008-10-28 15:29 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, linux-arch

I wrote stupid runtime checker to look for atomic_t uninitialized usage
and the amount of screaming in logs is surprisingly very big.

So the question: is there really really an arch for which setting atomic_t
by hand (kzalloc) is not equivalent to atomic_set()?

Given the following patch, there is none almost certainly.

--- a/kernel/user.c
+++ b/kernel/user.c
@@ -405,6 +405,9 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
 
 		new->uid = uid;
 		atomic_set(&new->__count, 1);
+		atomic_set(&new->processes, 0);
+		atomic_set(&new->files, 0);
+		atomic_set(&new->sigpending, 0);
 
 		if (sched_create_user(new) < 0)
 			goto out_free_user;


Such checker will still be useful to catch genuine uninitialized usages,
but the amount of stuff to shut up before it can realistically be put in -mm
is amazing.

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

end of thread, other threads:[~2008-10-28 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-28 15:29 On spreading atomic_t initialization Alexey Dobriyan
2008-10-28 15:54 ` Matthew Wilcox
2008-10-28 16:16 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).