All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: forbid filesystem accesses from within the kernel
@ 2018-07-05 21:47 Prakruthi Deepak Heragu
  2018-07-05 21:56 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Prakruthi Deepak Heragu @ 2018-07-05 21:47 UTC (permalink / raw)
  To: apw, joe; +Cc: linux-kernel, ckadabi, tsoni, bryanh, Prakruthi Deepak Heragu

As use of sys_open/close/read/write system calls from within the kernel 
code is inappropriate, an error is triggered if used.

Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>
---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a9c0550..e6e7e09 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5372,6 +5372,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/) {
 			CHK("REDUNDANT_CODE",
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-05 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-05 21:47 [PATCH] checkpatch: forbid filesystem accesses from within the kernel Prakruthi Deepak Heragu
2018-07-05 21:56 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.