History

Merge branch 'akpm' (patches from Andrew)

Merge more updates from Andrew Morton: "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f. Subsystems affected by this patch series: mm (memory-hotplug, rmap, ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan), alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib, checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig, selftests, ipc, and scripts" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (94 commits) scripts: check_extable: fix typo in user error message mm/workingset: correct kernel-doc notations ipc: replace costly bailout check in sysvipc_find_ipc() selftests/memfd: remove unused variable Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH configs: remove the obsolete CONFIG_INPUT_POLLDEV prctl: allow to setup brk for et_dyn executables pid: cleanup the stale comment mentioning pidmap_init(). kernel/fork.c: unexport get_{mm,task}_exe_file coredump: fix memleak in dump_vma_snapshot() fs/coredump.c: log if a core dump is aborted due to changed file permissions nilfs2: use refcount_dec_and_lock() to fix potential UAF nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group nilfs2: fix NULL pointer in nilfs_##name##_attr_release nilfs2: fix memory leak in nilfs_sysfs_create_device_group trap: cleanup trap_init() init: move usermodehelper_enable() to populate_rootfs() ...

Linus Torvalds committed 5 years ago

Commit 2d338202 parents cc09ee8 b285437149 files · +5341 −930Browse files

Showing the changes to scripts (2 of 149 files). Show all

Unified · Split

2 files
  1. scripts/check_extable.sh +1 −1
  2. scripts/checkpatch.pl +57 −36
scripts/check_extable.sh+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44
55 obj=$1
66
7−file ${obj} | grep -q ELF || (echo "${obj} is not and ELF file." 1>&2 ; exit 0)
7+file ${obj} | grep -q ELF || (echo "${obj} is not an ELF file." 1>&2 ; exit 0)
88
99 # Bail out early if there isn't an __ex_table section in this object file.
1010 objdump -hj __ex_table ${obj} 2> /dev/null > /dev/null
scripts/checkpatch.pl+57−36
@@ -501,7 +501,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?}; · 500 unmodified lines
501501 our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
502502 our $Int = qr{[0-9]+$Int_type?};
503503 our $Octal = qr{0[0-7]+$Int_type?};
504−our $String = qr{"[X\t]*"};
504+our $String = qr{(?:\b[Lu])?"[X\t]*"};
505505 our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
506506 our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
507507 our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
@@ -1181,7 +1181,8 @@ sub git_commit_info { · 673 unmodified lines
11811181 # git log --format='%H %s' -1 $line |
11821182 # echo "commit $(cut -c 1-12,41-)"
11831183 # done
1184− } elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
1184+ } elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./ ||
1185+ $lines[0] =~ /^fatal: bad object $commit/) {
11851186 $id = undef;
11861187 } else {
11871188 $id = substr($lines[0], 0, 12);
@@ -2587,6 +2588,8 @@ sub process { · 1399 unmodified lines
25872588 my $reported_maintainer_file = 0;
25882589 my $non_utf8_charset = 0;
25892590
2591+ my $last_git_commit_id_linenr = -1;
2592+
25902593 my $last_blank_line = 0;
25912594 my $last_coalesced_string_linenr = -1;
25922595
@@ -2909,10 +2912,10 @@ sub process { · 316 unmodified lines
29092912 my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
29102913 my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
29112914
2912− if ($email_address eq $author_address && $email_name eq $author_name) {
2915+ if (lc $email_address eq lc $author_address && $email_name eq $author_name) {
29132916 $author_sob = $ctx;
29142917 $authorsignoff = 2;
2915− } elsif ($email_address eq $author_address) {
2918+ } elsif (lc $email_address eq lc $author_address) {
29162919 $author_sob = $ctx;
29172920 $authorsignoff = 3;
29182921 } elsif ($email_name eq $author_name) {
@@ -3170,10 +3173,20 @@ sub process { · 251 unmodified lines
31703173 }
31713174
31723175 # Check for git id commit length and improperly formed commit descriptions
3173− if ($in_commit_log && !$commit_log_possible_stack_dump &&
3176+# A correctly formed commit description is:
3177+# commit <SHA-1 hash length 12+ chars> ("Complete commit subject")
3178+# with the commit subject '("' prefix and '")' suffix
3179+# This is a fairly compilicated block as it tests for what appears to be
3180+# bare SHA-1 hash with minimum length of 5. It also avoids several types of
3181+# possible SHA-1 matches.
3182+# A commit match can span multiple lines so this block attempts to find a
3183+# complete typical commit on a maximum of 3 lines
3184+ if ($perl_version_ok &&
3185+ $in_commit_log && !$commit_log_possible_stack_dump &&
31743186 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
31753187 $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
3176− ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3188+ (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3189+ ($line =~ /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,}\b/i)) ||
31773190 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
31783191 $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
31793192 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
@@ -3183,49 +3196,56 @@ sub process { · 3 unmodified lines
31833196 my $long = 0;
31843197 my $case = 1;
31853198 my $space = 1;
3186− my $hasdesc = 0;
3187− my $hasparens = 0;
31883199 my $id = '0123456789ab';
31893200 my $orig_desc = "commit description";
31903201 my $description = "";
3202+ my $herectx = $herecurr;
3203+ my $has_parens = 0;
3204+ my $has_quotes = 0;
3205+
3206+ my $input = $line;
3207+ if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
3208+ for (my $n = 0; $n < 2; $n++) {
3209+ if ($input =~ /\bcommit\s+[0-9a-f]{5,}\s*($balanced_parens)/i) {
3210+ $orig_desc = $1;
3211+ $has_parens = 1;
3212+ # Always strip leading/trailing parens then double quotes if existing
3213+ $orig_desc = substr($orig_desc, 1, -1);
3214+ if ($orig_desc =~ /^".*"$/) {
3215+ $orig_desc = substr($orig_desc, 1, -1);
3216+ $has_quotes = 1;
3217+ }
3218+ last;
3219+ }
3220+ last if ($#lines < $linenr + $n);
3221+ $input .= " " . trim($rawlines[$linenr + $n]);
3222+ $herectx .= "$rawlines[$linenr + $n]\n";
3223+ }
3224+ $herectx = $herecurr if (!$has_parens);
3225+ }
31913226
3192− if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
3227+ if ($input =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
31933228 $init_char = $1;
31943229 $orig_commit = lc($2);
3195− } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) {
3230+ $short = 0 if ($input =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3231+ $long = 1 if ($input =~ /\bcommit\s+[0-9a-f]{41,}/i);
3232+ $space = 0 if ($input =~ /\bcommit [0-9a-f]/i);
3233+ $case = 0 if ($input =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3234+ } elsif ($input =~ /\b([0-9a-f]{12,40})\b/i) {
31963235 $orig_commit = lc($1);
31973236 }
31983237
3199− $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3200− $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
3201− $space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
3202− $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3203− if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
3204− $orig_desc = $1;
3205− $hasparens = 1;
3206− } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
3207− defined $rawlines[$linenr] &&
3208− $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
3209− $orig_desc = $1;
3210− $hasparens = 1;
3211− } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
3212− defined $rawlines[$linenr] &&
3213− $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
3214− $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
3215− $orig_desc = $1;
3216− $rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
3217− $orig_desc .= " " . $1;
3218− $hasparens = 1;
3219− }
3220−
32213238 ($id, $description) = git_commit_info($orig_commit,
32223239 $id, $orig_desc);
32233240
32243241 if (defined($id) &&
3225− ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
3242+ ($short || $long || $space || $case || ($orig_desc ne $description) || !$has_quotes) &&
3243+ $last_git_commit_id_linenr != $linenr - 1) {
32263244 ERROR("GIT_COMMIT_ID",
3227− "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
3245+ "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herectx);
32283246 }
3247+ #don't report the next line if this line ends in commit and the sha1 hash is the next line
3248+ $last_git_commit_id_linenr = $linenr if ($line =~ /\bcommit\s*$/i);
32293249 }
32303250
32313251 # Check for added, moved or deleted files
@@ -6132,7 +6152,8 @@ sub process { · 2900 unmodified lines
61326152 }
61336153
61346154 # concatenated string without spaces between elements
6135− if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
6155+ if ($line =~ /$String[A-Z_]/ ||
6156+ ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
61366157 if (CHK("CONCATENATED_STRING",
61376158 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
61386159 $fix) {
@@ -6145,7 +6166,7 @@ sub process { · 6 unmodified lines
61456166 }
61466167
61476168 # uncoalesced string fragments
6148− if ($line =~ /$String\s*"/) {
6169+ if ($line =~ /$String\s*[Lu]?"/) {
61496170 if (WARN("STRING_FRAGMENTS",
61506171 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
61516172 $fix) {