Skip to content

Commit

Permalink
checkpatch: test SYMBOLIC_PERMS multiple times per line
Browse files Browse the repository at this point in the history
There are occasions where symbolic perms are used in a ternary like

		return (channel == 0) ? S_IRUGO | S_IWUSR : S_IRUGO;

The current test will find the first use "S_IRUGO | S_IWUSR" but not the
second use "S_IRUGO" on the same line.

Improve the test to look for all instances on a line.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Apr 11, 2018
1 parent 8d2e11b commit bc22d9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6429,7 +6429,7 @@ sub process {
}

# check for uses of S_<PERMS> that could be octal for readability
if ($line =~ /\b($multi_mode_perms_string_search)\b/) {
while ($line =~ m{\b($multi_mode_perms_string_search)\b}g) {
my $oval = $1;
my $octal = perms_to_octal($oval);
if (WARN("SYMBOLIC_PERMS",
Expand Down

0 comments on commit bc22d9a

Please sign in to comment.