summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Bean <gbean@codeaurora.org>2011-03-17 14:18:20 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:51:41 -0700
commit40bec6699af7f7bf33a9fd0aee419ee4b2840aa3 (patch)
tree1cfcac89f3a78e3ecc5fd4c5a7c087c87d392fdf
parent84ea4512d986bd6ee5482525880602f76f5d54d3 (diff)
checkpatch: forbid filesystem accesses from within the kernel.
Use of the sys_open/close/read/write system calls from within kernel code is inappropriate, and now triggers errors. Change-Id: I98e20513c257d0664684b7144585853f617d771a Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit ee62f2afcac1bcb180b2f0dddf2c8f5cda54bc5b) Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org> [abhimany: resolve trivial merge conflicts] Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
-rwxr-xr-xscripts/checkpatch.pl7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7057ee01178b..8f972e746990 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4894,6 +4894,13 @@ sub process {
"Avoid line continuations in quoted strings\n" . $herecurr);
}
+# sys_open/read/write/close are not allowed in the kernel
+ if ($line =~ /\b(sys_(?:open|read|write|close))\b/) {
+ ERROR("FILE_OPS",
+ "$1 is inappropriate in kernel code.\n" .
+ $herecurr);
+ }
+
# warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
WARN("IF_0",