From: Joe Perches <joe@perches.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
Andy Whitcroft <apw@canonical.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch.pl: New instances of ENOSYS are errors
Date: Fri, 22 Aug 2014 03:06:17 -0700 [thread overview]
Message-ID: <1408701977.22832.53.camel@joe-AO725> (raw)
In-Reply-To: <973469ca58b32c73c7c8ca68065e22a18574e112.1408680621.git.luto@amacapital.net>
On Thu, 2014-08-21 at 23:13 -0500, Andy Lutomirski wrote:
> 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.
[]
> diff --git 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);
> + }
> +
It seems this would be noisy.
ENOSYS seems to be used for a lot of other purposes
than syscalls.
Maybe this comment should be changed to clarify:
include/uapi/asm-generic/errno.h:#define ENOSYS 38 /* Function not implemented */
And this should probably be:
if ($line =~ /\bENOSYS\b/) {
The $herevet should be $herecurr
And this should be moved after line 2902 so that
it doesn't emit on patch context lines like:
$ git diff drivers/acpi/apei/erst.c
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index ed65e9c..acccc07 100644--git a
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -771,6 +771,7 @@ static int __erst_write_to_nvram(const struct cper_record_header *record)
static int __erst_read_to_erange_from_nvram(u64 record_id, u64 *offset)
{
pr_unimpl_nvram();
+
return -ENOSYS;
}
$ git diff drivers/acpi/apei/erst.c | ./scripts/checkpatch.pl -
ERROR: ENOSYS means 'invalid syscall nr' and nothing else
(ignore if this really is syscall entry code)
#10: FILE: drivers/acpi/apei/erst.c:775:
^Ireturn -ENOSYS;$
prev parent reply other threads:[~2014-08-22 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-22 4:13 Andy Lutomirski
2014-08-22 10:06 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408701977.22832.53.camel@joe-AO725 \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®