[Linux-kernel-mentees] [PATCH] checkpatch: add fix for BAD_SIGN_OFF

Lukas Bulwahn lukas.bulwahn at gmail.com
Wed Nov 4 11:14:20 UTC 2020


On Tue, Nov 3, 2020 at 4:19 PM Aditya Srivastava <yashsri421 at gmail.com> wrote:
>
> Currently, checkpatch warns us if the author of the commit signs-off
> as co-developed-by.
> E.g. for commit 6e88559470f5 ("Documentation: Add section about
> CPU vulnerabilities for Spectre") we get:
>
> WARNING: Co-developed-by: should not be used to attribute nominal
> patch author 'Tim Chen <tim.c.chen at linux.intel.com>'
> Co-developed-by: Tim Chen <tim.c.chen at linux.intel.com>
>
> Provide a simple fix by removing the co-developed-by line from the
> commit message
>

Patch looks good. Maybe you can add a statistics on how many cases of
the last 200,000 commits this rule would actually trigger?

E.g., you can probably quickly filter all commits that have at least
one Co-developed-by tag among those last 200,000 commits (that is
already only a few thousands), then take that list and just check with
checkpatch.pl for this one rule quickly to see how often the rule
would even trigger at all.

Once you have that and explain that in the commit message, I think the
patch is ready for lkml and Joe Perches.

Lukas

> Signed-off-by: Aditya Srivastava <yashsri421 at gmail.com>
> ---
>  scripts/checkpatch.pl | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 58095d9d8f34..1030d4fc2abf 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2827,8 +2827,11 @@ sub process {
>  # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
>                         if ($sign_off =~ /^co-developed-by:$/i) {
>                                 if ($email eq $author) {
> -                                       WARN("BAD_SIGN_OFF",
> -                                             "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
> +                                       if (WARN("BAD_SIGN_OFF",
> +                                                "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
> +                                           $fix) {
> +                                               fix_delete_line($fixlinenr, $rawline);
> +                                       }
>                                 }
>                                 if (!defined $lines[$linenr]) {
>                                         WARN("BAD_SIGN_OFF",
> --
> 2.17.1
>


More information about the Linux-kernel-mentees mailing list