diff options
author | Joe Perches <joe@perches.com> | 2014-04-03 21:49:15 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 23:21:13 (GMT) |
commit | 1727cc70451017e6d9c0129681792c18f166af75 (patch) | |
tree | b09810ebd74791d336091cfb63d714d42655ec73 | |
parent | fbdb8138cf0c75a0cf21991ca05ecc9fdff6e070 (diff) | |
download | linux-1727cc70451017e6d9c0129681792c18f166af75.tar.xz |
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>
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1054283..9f12213 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); } } } |