[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090127053920.GB5034@bombadil.infradead.org>
Date: Tue, 27 Jan 2009 00:39:20 -0500
From: Kyle McMartin <kyle@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kyle McMartin <kyle@...radead.org>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Christoph Bartelmus <lirc@...telmus.de>,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Whitcroft <apw@...dowen.org>
Subject: [PATCH] make checkpatch warn about access to current->comm
From: Kyle McMartin <kyle@...hat.com>
Suggest using the get_task_comm accessor versus direct access to
current->comm.
Signed-off-by: Kyle McMartin <kyle@...hat.com>
---
I just mashed it in the middle of existing checks to minimize risk of
collisions.
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45eb0ae..4f2da5d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2533,6 +2533,11 @@ sub process {
$herecurr);
}
+# direct access to current task name is racy, suggest accessor instead.
+ if ($line =~ /current\-\>comm/) {
+ WARN("direct access to current->comm is racy, use get_task_comm() instead.\n" . $herecurr);
+ }
+
# use of NR_CPUS is usually wrong
# ignore definitions of NR_CPUS and usage to define arrays as likely right
if ($line =~ /\bNR_CPUS\b/ &&
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists