diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 28 |
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; | |||
| 13 | use File::Basename; | 13 | use File::Basename; |
| 14 | use Cwd 'abs_path'; | 14 | use Cwd 'abs_path'; |
| 15 | use Term::ANSIColor qw(:constants); | 15 | use Term::ANSIColor qw(:constants); |
| 16 | use Encode qw(decode encode); | ||
| 16 | 17 | ||
| 17 | my $P = $0; | 18 | my $P = $0; |
| 18 | my $D = dirname(abs_path($P)); | 19 | my $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(); |
