[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9de4fb8fa1223fc61d6d8d8c41066eea3963c12e.camel@perches.com>
Date: Wed, 01 Apr 2020 08:17:52 -0700
From: Joe Perches <joe@...ches.com>
To: Marco Elver <elver@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: paulmck@...nel.org, dvyukov@...gle.com, glider@...gle.com,
andreyknvl@...gle.com, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org, apw@...onical.com,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] checkpatch: Warn about data_race() without comment
On Wed, 2020-04-01 at 12:17 +0200, Marco Elver wrote:
> Warn about applications of data_race() without a comment, to encourage
> documenting the reasoning behind why it was deemed safe.
[]
> diff --git 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",
Sensible enough but it looks like ctx_has_comment should
be updated to allow c99 comments too, but that should be
a separate change from this patch.
Otherwise, this style emits a message:
WARNING: data_race without comment
#135: FILE: kernel/rcu/tasks.h:135:
+ int i = data_race(rtp->gp_state); // Let KCSAN detect update races
Powered by blists - more mailing lists