aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2018-08-22 00:57:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-22 13:52:48 -0400
commitcd2614967d8b636911a39dd639aa5b87cf280945 (patch)
tree13b04113b04c3afc16ad63f89b494479acfeb013 /scripts
parent33aa4597dda21348590452656728af2553d2d572 (diff)
checkpatch: warn if missing author Signed-off-by
Print a warning if none of the Signed-off-by lines cover the patch author. Non-ASCII quoted printable encoding in From: headers and (lack of) double quotes are handled. Split From: headers are not fully handled: only the first part is compared. [geert+renesas@glider.be: only encode UTF-8 quoted printable mail headers] Link: http://lkml.kernel.org/r/20180718145254.4770-1-geert+renesas@glider.be Link: http://lkml.kernel.org/r/20180712100323.26684-1-geert+renesas@glider.be Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Joe Perches <joe@perches.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl28
1 files changed, 25 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b5c875d7132b..022a77b98123 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -13,6 +13,7 @@ use POSIX;
13use File::Basename; 13use File::Basename;
14use Cwd 'abs_path'; 14use Cwd 'abs_path';
15use Term::ANSIColor qw(:constants); 15use Term::ANSIColor qw(:constants);
16use Encode qw(decode encode);
16 17
17my $P = $0; 18my $P = $0;
18my $D = dirname(abs_path($P)); 19my $D = dirname(abs_path($P));
@@ -2236,6 +2237,8 @@ sub process {
2236 2237
2237 our $clean = 1; 2238 our $clean = 1;
2238 my $signoff = 0; 2239 my $signoff = 0;
2240 my $author = '';
2241 my $authorsignoff = 0;
2239 my $is_patch = 0; 2242 my $is_patch = 0;
2240 my $in_header_lines = $file ? 0 : 1; 2243 my $in_header_lines = $file ? 0 : 1;
2241 my $in_commit_log = 0; #Scanning lines before patch 2244 my $in_commit_log = 0; #Scanning lines before patch
@@ -2518,10 +2521,24 @@ sub process {
2518 } 2521 }
2519 } 2522 }
2520 2523
2524# Check the patch for a From:
2525 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2526 $author = $1;
2527 $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
2528 $author =~ s/"//g;
2529 }
2530
2521# Check the patch for a signoff: 2531# Check the patch for a signoff:
2522 if ($line =~ /^\s*signed-off-by:/i) { 2532 if ($line =~ /^\s*signed-off-by:/i) {
2523 $signoff++; 2533 $signoff++;
2524 $in_commit_log = 0; 2534 $in_commit_log = 0;
2535 if ($author ne '') {
2536 my $l = $line;
2537 $l =~ s/"//g;
2538 if ($l =~ /^\s*signed-off-by:\s*\Q$author\E/i) {
2539 $authorsignoff = 1;
2540 }
2541 }
2525 } 2542 }
2526 2543
2527# Check if MAINTAINERS is being updated. If so, there's probably no need to 2544# Check if MAINTAINERS is being updated. If so, there's probably no need to
@@ -6507,9 +6524,14 @@ sub process {
6507 ERROR("NOT_UNIFIED_DIFF", 6524 ERROR("NOT_UNIFIED_DIFF",
6508 "Does not appear to be a unified-diff format patch\n"); 6525 "Does not appear to be a unified-diff format patch\n");
6509 } 6526 }
6510 if ($is_patch && $has_commit_log && $chk_signoff && $signoff == 0) { 6527 if ($is_patch && $has_commit_log && $chk_signoff) {
6511 ERROR("MISSING_SIGN_OFF", 6528 if ($signoff == 0) {
6512 "Missing Signed-off-by: line(s)\n"); 6529 ERROR("MISSING_SIGN_OFF",
6530 "Missing Signed-off-by: line(s)\n");
6531 } elsif (!$authorsignoff) {
6532 WARN("NO_AUTHOR_SIGN_OFF",
6533 "Missing Signed-off-by: line by nominal patch author '$author'\n");
6534 }
6513 } 6535 }
6514 6536
6515 print report_dump(); 6537 print report_dump();