[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1419784907-6614-1-git-send-email-der.herr@hofr.at>
Date: Sun, 28 Dec 2014 11:41:47 -0500
From: Nicholas Mc Guire <der.herr@...r.at>
To: Andy Whitcroft <apw@...onical.com>
Cc: Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org,
Nicholas Mc Guire <der.herr@...r.at>
Subject: [PATCH RFC] checkpatch: fix for catching all world writable settings
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@...r.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists