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: <20200402031254.GO19865@paulmck-ThinkPad-P72>
Date:   Wed, 1 Apr 2020 20:12:54 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Marco Elver <elver@...gle.com>, dvyukov@...gle.com,
        glider@...gle.com, andreyknvl@...gle.com,
        kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
        apw@...onical.com, Will Deacon <will@...nel.org>
Subject: Re: [PATCH] checkpatch: Look for c99 comments in ctx_locate_comment

On Wed, Apr 01, 2020 at 07:20:30PM -0700, Joe Perches wrote:
> Some checks look for comments around a specific function like
> read_barrier_depends.
> 
> Extend the check to support both c89 and c90 comment styles.
> 
> 	c89 /* comment */
> or
> 	c99 // comment
> 
> For c99 comments, only look a 3 single lines, the line being scanned,
> the line above and the line below the line being scanned rather than
> the patch diff context.
> 
> Signed-off-by: Joe Perches <joe@...ches.com>

Tested-by: Paul E. McKenney <paulmck@...nel.org>

> ---
>  scripts/checkpatch.pl | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d64c67..0f4db4 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1674,8 +1674,16 @@ sub ctx_statement_level {
>  sub ctx_locate_comment {
>  	my ($first_line, $end_line) = @_;
>  
> +	# If c99 comment on the current line, or the line before or after
> +	my ($current_comment) = ($rawlines[$end_line - 1] =~ m@^\+.*(//.*$)@);
> +	return $current_comment if (defined $current_comment);
> +	($current_comment) = ($rawlines[$end_line - 2] =~ m@^[\+ ].*(//.*$)@);
> +	return $current_comment if (defined $current_comment);
> +	($current_comment) = ($rawlines[$end_line] =~ m@^[\+ ].*(//.*$)@);
> +	return $current_comment if (defined $current_comment);
> +
>  	# Catch a comment on the end of the line itself.
> -	my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
> +	($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
>  	return $current_comment if (defined $current_comment);
>  
>  	# Look through the context and try and figure out if there is a
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ