lkml.org 
[lkml]   [2014]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC] checkpatch: fix for catching all world writable settings
Date
Currently checkpatch will fuss if one uses world writable settings in debugfs
files by passing S_IWUGO but not when passing S_IRWXUGO. This patch extends
the check to cover the S_IRWXUGO case.

tested on trivial examples:
WARNING: Exporting world writable files is usually an error. Consider more
restrictive permissions.
#72: FILE: test.c:72:
+ id_file = debugfs_create_file("id", S_IRUGO | S_IWUGO, my_dir,

with the patch applied it also fusses now in the S_IRWXUGO case.
WARNING: Exporting world writable files is usually an error. Consider more
restrictive permissions.
#72: FILE: test.c:72:
+ id_file = debugfs_create_file("id", S_IRWXUGO, my_dir,

patch is against linux-next 3.19.0-rc1 -next-20141226

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
scripts/checkpatch.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0bb6d6..48120b1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5227,7 +5227,9 @@ sub process {
}

if ($line =~ /debugfs_create_file.*S_IWUGO/ ||
- $line =~ /DEVICE_ATTR.*S_IWUGO/ ) {
+ $line =~ /debugfs_create_file.*S_IRWXUGO/ ||
+ $line =~ /DEVICE_ATTR.*S_IWUGO/ ||
+ $line =~ /DEVICE_ATTR.*S_IRWXUGO/ ) {
WARN("EXPORTED_WORLD_WRITABLE",
"Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
}
--
1.7.10.4


\
 
 \ /
  Last update: 2014-12-28 18:21    [W:0.017 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site