All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: New instances of ENOSYS are errors
@ 2014-08-22  4:13 Andy Lutomirski
  2014-08-22 10:06 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2014-08-22  4:13 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages), Andy Whitcroft, Joe Perches
  Cc: linux-kernel, Andy Lutomirski

ENOSYS means that a nonexistent system call was called.  We have a
bad habit of using it for things like invalid operations on
otherwise valid syscalls.  We should avoid this in new code.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---

Pervasive incorrect usage of ENOSYS came up at the kernel summit ABI
review discussion.  Let's see if checkpatch can help.

 scripts/checkpatch.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 182be0f..5749a44 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2372,6 +2372,15 @@ sub process {
 			     "Using $1 is unnecessary\n" . $herecurr);
 		}
 
+# ENOSYS means "bad syscall nr" and nothing else
+# (note that this doesn't run on assembly files, so entry*.S is okay)
+		if ($line =~ /ENOSYS/) {
+			my $herevet = "$here\n" . cat_vet($line) . "\n";
+			ERROR("ENOSYS",
+			      "ENOSYS means 'invalid syscall nr' and nothing else\n" .
+			      "       (ignore if this really is syscall entry code)\n" . $herevet);
+		}
+
 # Check for potential 'bare' types
 		my ($stat, $cond, $line_nr_next, $remain_next, $off_next,
 		    $realline_next);
-- 
1.9.3


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

end of thread, other threads:[~2014-08-22 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22  4:13 [PATCH] checkpatch.pl: New instances of ENOSYS are errors Andy Lutomirski
2014-08-22 10:06 ` 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.