linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors
@ 2014-08-22 18:05 Andy Lutomirski
  2014-08-22 18:14 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Lutomirski @ 2014-08-22 18:05 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.

I'll submit a separate patch for include/uapi/asm-generic/errno.h.

Changes from v2:
 - Reduce severity to WARN.
 - Remove unnecessary clarification.
 - Rebase onto Linus' tree instead of v3.16.

Changes from v1:
 - Moved later so that it won't warn on context lines.
 - Use $herecur.
 - Improve regex pattern.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 31a731e..448d075 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3214,6 +3214,14 @@ sub process {
 			     "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
 		}
 
+# ENOSYS means "bad syscall nr" and nothing else.  This will have a small
+# number of false positives, but assembly files are not checked, so at
+# least the arch entry code will not trigger this warning.
+		if ($line =~ /\bENOSYS\b/) {
+			WARN("ENOSYS",
+			     "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
+		}
+
 # function brace can't be on same line, except for #defines of do while,
 # or if closed on same line
 		if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-- 
1.9.3


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

* Re: [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors
  2014-08-22 18:05 [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors Andy Lutomirski
@ 2014-08-22 18:14 ` Joe Perches
  2015-04-10 22:30   ` Andy Lutomirski
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-08-22 18:14 UTC (permalink / raw)
  To: Andy Lutomirski, Andrew Morton
  Cc: Michael Kerrisk (man-pages), Andy Whitcroft, linux-kernel

On Fri, 2014-08-22 at 11:05 -0700, 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.

Seems sensible thanks for persisting.

Andrew Morton is generally the upstream path (cc'd)

> 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.
> 
> I'll submit a separate patch for include/uapi/asm-generic/errno.h.
> 
> Changes from v2:
>  - Reduce severity to WARN.
>  - Remove unnecessary clarification.
>  - Rebase onto Linus' tree instead of v3.16.
> 
> Changes from v1:
>  - Moved later so that it won't warn on context lines.
>  - Use $herecur.
>  - Improve regex pattern.
> 
>  scripts/checkpatch.pl | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 31a731e..448d075 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3214,6 +3214,14 @@ sub process {
>  			     "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
>  		}
>  
> +# ENOSYS means "bad syscall nr" and nothing else.  This will have a small
> +# number of false positives, but assembly files are not checked, so at
> +# least the arch entry code will not trigger this warning.
> +		if ($line =~ /\bENOSYS\b/) {
> +			WARN("ENOSYS",
> +			     "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
> +		}
> +
>  # function brace can't be on same line, except for #defines of do while,
>  # or if closed on same line
>  		if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and




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

* Re: [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors
  2014-08-22 18:14 ` Joe Perches
@ 2015-04-10 22:30   ` Andy Lutomirski
  2015-04-10 22:44     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Lutomirski @ 2015-04-10 22:30 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Morton, Michael Kerrisk (man-pages), Andy Whitcroft, linux-kernel

On Fri, Aug 22, 2014 at 11:14 AM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2014-08-22 at 11:05 -0700, 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.
>
> Seems sensible thanks for persisting.
>
> Andrew Morton is generally the upstream path (cc'd)
>
>> 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.
>>
>> I'll submit a separate patch for include/uapi/asm-generic/errno.h.
>>
>> Changes from v2:
>>  - Reduce severity to WARN.
>>  - Remove unnecessary clarification.
>>  - Rebase onto Linus' tree instead of v3.16.
>>
>> Changes from v1:
>>  - Moved later so that it won't warn on context lines.
>>  - Use $herecur.
>>  - Improve regex pattern.
>>
>>  scripts/checkpatch.pl | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 31a731e..448d075 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -3214,6 +3214,14 @@ sub process {
>>                            "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
>>               }
>>
>> +# ENOSYS means "bad syscall nr" and nothing else.  This will have a small
>> +# number of false positives, but assembly files are not checked, so at
>> +# least the arch entry code will not trigger this warning.
>> +             if ($line =~ /\bENOSYS\b/) {
>> +                     WARN("ENOSYS",
>> +                          "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
>> +             }
>> +
>>  # function brace can't be on same line, except for #defines of do while,
>>  # or if closed on same line
>>               if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>
>
>

Ping, akpm?

--Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC

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

* Re: [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors
  2015-04-10 22:30   ` Andy Lutomirski
@ 2015-04-10 22:44     ` Joe Perches
  2015-04-10 22:56       ` Andy Lutomirski
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2015-04-10 22:44 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Andrew Morton, Michael Kerrisk (man-pages), Andy Whitcroft, linux-kernel

On Fri, 2015-04-10 at 15:30 -0700, Andy Lutomirski wrote:
> On Fri, Aug 22, 2014 at 11:14 AM, Joe Perches <joe@perches.com> wrote:
> > On Fri, 2014-08-22 at 11:05 -0700, 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.
[]
> >> I'll submit a separate patch for include/uapi/asm-generic/errno.h.

Did anything happen with the errno.h patch?



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

* Re: [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors
  2015-04-10 22:44     ` Joe Perches
@ 2015-04-10 22:56       ` Andy Lutomirski
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Lutomirski @ 2015-04-10 22:56 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Morton, Michael Kerrisk (man-pages), Andy Whitcroft, linux-kernel

On Fri, Apr 10, 2015 at 3:44 PM, Joe Perches <joe@perches.com> wrote:
> On Fri, 2015-04-10 at 15:30 -0700, Andy Lutomirski wrote:
>> On Fri, Aug 22, 2014 at 11:14 AM, Joe Perches <joe@perches.com> wrote:
>> > On Fri, 2014-08-22 at 11:05 -0700, 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.
> []
>> >> I'll submit a separate patch for include/uapi/asm-generic/errno.h.
>
> Did anything happen with the errno.h patch?
>
>

Thanks for the reminder.  I just emailed out v2.

--Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC

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

end of thread, other threads:[~2015-04-10 22:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22 18:05 [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors Andy Lutomirski
2014-08-22 18:14 ` Joe Perches
2015-04-10 22:30   ` Andy Lutomirski
2015-04-10 22:44     ` Joe Perches
2015-04-10 22:56       ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).