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>
This commit is contained in:
Gregory Bean 2011-03-17 14:18:20 -07:00 committed by Stepan Moskovchenko
parent 70bc57d900
commit e13b42689d
1 changed files with 7 additions and 0 deletions

View File

@ -4479,6 +4479,13 @@ sub process {
"Concatenated strings should use spaces between elements\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",