From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932461AbbDJWbP (ORCPT ); Fri, 10 Apr 2015 18:31:15 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34336 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbbDJWbN (ORCPT ); Fri, 10 Apr 2015 18:31:13 -0400 MIME-Version: 1.0 In-Reply-To: <1408731270.17241.12.camel@joe-AO725> References: <5eb299021dec23c1a48fa7d9f2c8b794e967766d.1408730669.git.luto@amacapital.net> <1408731270.17241.12.camel@joe-AO725> From: Andy Lutomirski Date: Fri, 10 Apr 2015 15:30:52 -0700 Message-ID: Subject: Re: [PATCH v3] checkpatch.pl: New instances of ENOSYS are errors To: Joe Perches Cc: Andrew Morton , "Michael Kerrisk (man-pages)" , Andy Whitcroft , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 22, 2014 at 11:14 AM, Joe Perches 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 >> --- >> >> 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