From: Joe Perches Date: Thu, 3 Apr 2014 21:49:15 +0000 (-0700) Subject: checkpatch: update octal permissions warning X-Git-Tag: v3.15-rc1~106^2~89 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1727cc70451017e6d9c0129681792c18f166af75;p=karo-tx-linux.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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); } } }