Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b7fd1b6 authored by Gregory Bean's avatar Gregory Bean Committed by Bryan Huntsman
Browse files

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: default avatarGregory Bean <gbean@codeaurora.org>
(cherry picked from commit ee62f2afcac1bcb180b2f0dddf2c8f5cda54bc5b)
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: default avatarAbhimanyu Kapur <abhimany@codeaurora.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
parent b1122c7a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5379,6 +5379,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",