lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39ba164ba44be848feac831f2f21effca92bfc96.camel@perches.com>
Date:   Tue, 30 Jun 2020 07:46:57 -0700
From:   Joe Perches <joe@...ches.com>
To:     Quentin Monnet <quentin@...valent.com>,
        Andy Whitcroft <apw@...onical.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vadim Bendebury <vbendeb@...omium.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: prevent reporting C99_COMMENTS error for
 SPDX tag in .c file

(adding Vadem Bendebury who added the tolerance test)

On Tue, 2020-06-30 at 15:35 +0100, Quentin Monnet wrote:
> When checkpatch.pl is invoked with "--ignore C99_COMMENT_TOLERANCE", it
> reports C99-style comments found in the code, by matching on the
> double-slash pattern "//". This includes the leading slashes before the
> SPDX tags that are now used in a majority of C files.
> 
> Such tags are commented with the double-slash on purpose, and should not
> trigger errors from checkpatch. Let's ignore them when searching for
> C99-style comments to report.
> 
> Signed-off-by: Quentin Monnet <quentin@...valent.com>

I think this unnecessary as perhaps those that want no
c99 comments likely _really_ want no c99 comments.

> ---
>  scripts/checkpatch.pl | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3cacc122c528..67f350c580ea 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3983,7 +3983,10 @@ sub process {
>  		}
>  
>  # no C99 // comments
> -		if ($line =~ m{//}) {
> +		if ($line =~ m{//} &&
> +		    !($rawline =~ m{// SPDX-License-Identifier:} &&
> +		      $realfile =~ /\.c$/ &&
> +		      $realline == $checklicenseline)) {
>  			if (ERROR("C99_COMMENTS",
>  				  "do not use C99 // comments\n" . $herecurr) &&
>  			    $fix) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ