linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Warn about data_race() without comment
@ 2020-04-01 10:17 Marco Elver
  2020-04-01 10:32 ` Will Deacon
  2020-04-01 15:17 ` Joe Perches
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Elver @ 2020-04-01 10:17 UTC (permalink / raw)
  To: elver
  Cc: paulmck, dvyukov, glider, andreyknvl, kasan-dev, linux-kernel,
	apw, joe, Will Deacon

Warn about applications of data_race() without a comment, to encourage
documenting the reasoning behind why it was deemed safe.

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Marco Elver <elver@google.com>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a63380c6b0d2..48bb9508e300 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5833,6 +5833,14 @@ sub process {
 			}
 		}
 
+# check for data_race without a comment.
+		if ($line =~ /\bdata_race\s*\(/) {
+			if (!ctx_has_comment($first_line, $linenr)) {
+				WARN("DATA_RACE",
+				     "data_race without comment\n" . $herecurr);
+			}
+		}
+
 # check for smp_read_barrier_depends and read_barrier_depends
 		if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
 			WARN("READ_BARRIER_DEPENDS",
-- 
2.26.0.rc2.310.g2932bb562d-goog


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

end of thread, other threads:[~2020-04-16  9:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 10:17 [PATCH] checkpatch: Warn about data_race() without comment Marco Elver
2020-04-01 10:32 ` Will Deacon
2020-04-01 15:17 ` Joe Perches
2020-04-01 15:38   ` Paul E. McKenney
2020-04-02  2:20     ` [PATCH] checkpatch: Look for c99 comments in ctx_locate_comment Joe Perches
2020-04-02  3:12       ` Paul E. McKenney
2020-04-16  9:27   ` [PATCH] checkpatch: Warn about data_race() without comment Marco Elver

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