]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
checkpatch: update octal permissions warning
authorJoe Perches <joe@perches.com>
Thu, 3 Apr 2014 21:49:15 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2014 23:21:13 +0000 (16:21 -0700)
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>
scripts/checkpatch.pl

index 1054283c6e70e705f6310dea6fef6daa263779e8..9f12213d81cf9fc1cf0f716fbcfa9d0a07976518 100755 (executable)
@@ -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);
                                }
                        }
                }