summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-04-03 14:49:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 16:21:13 -0700
commit1727cc70451017e6d9c0129681792c18f166af75 (patch)
treeb09810ebd74791d336091cfb63d714d42655ec73 /scripts
parentfbdb8138cf0c75a0cf21991ca05ecc9fdff6e070 (diff)
checkpatch: update octal permissions warning
When checking permissions, make sure 4 octal digits are used, but allow a single 0 too. Signed-off-by: Joe Perches <joe@perches.com> 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.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1054283c6e70..9f12213d81cf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4512,9 +4512,11 @@ sub process {
my $val = $1;
$val = $6 if ($skip_args ne "");
- if ($val =~ /^$Int$/ && $val !~ /^$Octal$/) {
+ if ($val !~ /^0$/ &&
+ (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
+ length($val) ne 4)) {
ERROR("NON_OCTAL_PERMISSIONS",
- "Use octal not decimal permissions\n" . $herecurr);
+ "Use 4 digit octal (0777) not decimal permissions\n" . $herecurr);
}
}
}