On Thu, 2025-09-18 at 15:59 +0200, Marco Elver wrote:
> Warn about applications of capability_unsafe() without a comment, to
> encourage documenting the reasoning behind why it was deemed safe.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -6717,6 +6717,14 @@ sub process {
> }
> }
>
> +# check for capability_unsafe without a comment.
> + if ($line =~ /\bcapability_unsafe\b/) {
> + if (!ctx_has_comment($first_line, $linenr)) {
> + WARN("CAPABILITY_UNSAFE",
> + "capability_unsafe without comment\n" . $herecurr);
while most of these are using the same multi-line style
I'd prefer combining and reducing indentation
if ($line =~ /\bcapability_unsafe\b/ &&
!ctx_has_comment($first_line, $linenr)) {
WARN(etc...