mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Andy Whitcroft <apw@canonical.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Kees Cook <keescook@chromium.org>,
	Sasha Levin <sashal@kernel.org>, Tom Gall <tom.gall@linaro.org>
Subject: Re: [PATCH] checkpatch: check for missing Fixes tags
Date: Tue, 06 Jun 2023 08:11:03 -0700	[thread overview]
Message-ID: <9717acd3dd00d607da718da251a0bba6b376da96.camel@perches.com> (raw)
In-Reply-To: <ZH7uo6ph8nhidxcV@moroto>

On Tue, 2023-06-06 at 11:30 +0300, Dan Carpenter wrote:
> This check looks for common words that probably indicate a patch
> is a fix.  For now the regex is:
> 
> 	(BUG: KASAN|Call Trace:|syzkaller|stable\@)

Seems sensible.  Style notes:


> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3186,6 +3192,12 @@ sub process {
>  			}
>  		}
>  
> +# These indicate a bug fix
> +		if (!$in_header_lines &&
> +			$line =~ /(BUG: KASAN|Call Trace:|syzkaller|stable\@)/) {
> +			$needs_fixes_tag++;

Align to open parenthesis please.
Maybe add "Closes:"
This should not check any actual patch lines.

So this should likely use

		if (!$in_header_lines && !$is_patch &&
		    $line =~ /\b(?:BUG: KASAN|Call Trace:|Closes:|syzkaller|stable\@)/) {

There's no use of $needs_fixes_tag as something
other than a bool, so please just use

			$needs_fixes_tag = 1;

> @@ -3198,6 +3210,7 @@ sub process {
>  			my $id_length = 1;
>  			my $id_case = 1;
>  			my $title_has_quotes = 0;
> +			$fixes_tag++;

			$fixes_tag = 1;

here too

> @@ -7636,6 +7649,12 @@ sub process {
>  		ERROR("NOT_UNIFIED_DIFF",
>  		      "Does not appear to be a unified-diff format patch\n");
>  	}
> +	if ($is_patch && $has_commit_log && $chk_fixes_tag) {
> +		if ($needs_fixes_tag && $fixes_tag == 0) {

		if ($needs_fixes_tag && !$fixes_tag) {

> +			ERROR("MISSING_FIXES_TAG",
> +			"This looks like a fix but there is no Fixes: tag\n");

Alignment to open parenthesis and likely WARN not ERROR


  parent reply	other threads:[~2023-06-06 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  8:30 Dan Carpenter
2023-06-06 10:18 ` Greg Kroah-Hartman
2023-06-06 11:39 ` Thorsten Leemhuis
2023-06-06 15:11 ` Joe Perches [this message]
2023-06-06 15:13   ` Dan Carpenter

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=9717acd3dd00d607da718da251a0bba6b376da96.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@linaro.org \
    --cc=dwaipayanray1@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=sashal@kernel.org \
    --cc=tom.gall@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®