* [PATCH] checkpatch: Test SYMBOLIC_PERMS multiple times per line
@ 2018-03-27 5:19 Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2018-03-27 5:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andy Whitcroft, LKML
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.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5fe361e1ed5e..d2464002bb40 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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",
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-27 5:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 5:19 [PATCH] checkpatch: Test SYMBOLIC_PERMS multiple times per line Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome