LKML Archive on
help / color / mirror / Atom feed
From: Alexey Dobriyan <>
Subject: On spreading atomic_t initialization
Date: Tue, 28 Oct 2008 18:29:43 +0300	[thread overview]
Message-ID: <20081028152943.GA20989@x200.localdomain> (raw)

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.

             reply	other threads:[~2008-10-28 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 15:29 Alexey Dobriyan [this message]
2008-10-28 15:54 ` Matthew Wilcox
2008-10-28 16:16 ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081028152943.GA20989@x200.localdomain \ \ \ \ \ \
    --subject='Re: On spreading atomic_t initialization' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).