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: <f2f39283-677f-e617-5edb-f55624ac21e2@ghiti.fr>
Date:   Sun, 17 Mar 2019 11:49:24 -0400
From:   Alex Ghiti <alex@...ti.fr>
To:     Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] scripts: checkpatch: Check multiple blank lines when
 deleting code

On 3/6/19 2:53 PM, Alexandre Ghiti wrote:
> By matching only current line starting with '+', we miss the case
> when deleting code makes consecutive blank lines appear: this patch
> then makes it possible to detect this case by also matching current
> line starting with ' ', which is an already existing blank line.
>
> Signed-off-by: Alexandre Ghiti <alex@...ti.fr>
> ---
>
> Changes in v3 as suggested by Joe Perches:
> 	- Do not try to fix this case
> 	- Make this test separate from the insertion one so that warning
> 	  is more explicit
>
> Changes in v2:
> 	- Fix the --fix option
>
>   scripts/checkpatch.pl | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index b737ca9d7204..c0728cff292f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3296,7 +3296,7 @@ sub process {
>   			}
>   		}
>   
> -# check for multiple consecutive blank lines
> +# check for multiple consecutive blank lines caused by blank line insertion
>   		if ($prevline =~ /^[\+ ]\s*$/ &&
>   		    $line =~ /^\+\s*$/ &&
>   		    $last_blank_line != ($linenr - 1)) {
> @@ -3309,6 +3309,16 @@ sub process {
>   			$last_blank_line = $linenr;
>   		}
>   
> +# check for multiple consecutive blank lines caused by code deletion
> +		if ($prevline =~ /^[\+ ]\s*$/ &&
> +		    $line =~ /^ \s*$/ &&
> +		    $last_blank_line != ($linenr - 1)) {
> +			CHK("LINE_SPACING",
> +			    "Avoid deleting lines that create consecutive blank lines\n" . $hereprev);
> +
> +			$last_blank_line = $linenr;
> +		}
> +
>   # check for missing blank lines after declarations
>   		if ($sline =~ /^\+\s+\S/ &&			#Not at char 1
>   			# actual declarations


Hi Joe,

Can I do something more this patch ?

Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ