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: <20221123011202.939319-5-elliott@hpe.com>
Date:   Tue, 22 Nov 2022 19:12:01 -0600
From:   Robert Elliott <elliott@....com>
To:     apw@...onical.com, joe@...ches.com, dwaipayanray1@...il.com,
        lukas.bulwahn@...il.com
Cc:     linux-kernel@...r.kernel.org, Robert Elliott <elliott@....com>
Subject: [PATCH v2 4/5] checkpatch: discard processed lines

Advance the line numbers so messages don't repeat previously
processed lines.

Before:
	WARNING: please write 4 lines of help text that fully describes the
	config symbol (detected 3 lines)
	#195: FILE: crypto/Kconfig:837:
	+config CRYPTO_GHASH_CLMUL_NI_INTEL
	+       tristate "GHASH (x86_64 with CLMUL-NI)"
		depends on X86 && 64BIT
	+       select CRYPTO_CRYPTD
	+       select CRYPTO_CRYPTD
	+       select CRYPTO_CRYPTD
		help
	+         GCM GHASH hash function (NIST SP800-38D)
	+         GCM GHASH hash function (NIST SP800-38D)

		  Architecture: x86_64 using:
	+         * CLMUL-NI (carry-less multiplication new instructions)
	+         * CLMUL-NI (carry-less multiplication new instructions)
	+         * CLMUL-NI (carry-less multiplication new instructions)

	+config CRYPTO_GHASH_S390
	+config CRYPTO_GHASH_S390
	+config CRYPTO_GHASH_S390
	+config CRYPTO_GHASH_S390

After:
	WARNING: please write 4 lines of help text that fully describes the
	config symbol (detected 3 lines)
	#195: FILE: crypto/Kconfig:837:
	+config CRYPTO_GHASH_CLMUL_NI_INTEL
	+       tristate "GHASH (x86_64 with CLMUL-NI)"
		depends on X86 && 64BIT
	+       select CRYPTO_CRYPTD
		help
	+         GCM GHASH hash function (NIST SP800-38D)

		  Architecture: x86_64 using:
	+         * CLMUL-NI (carry-less multiplication new instructions)

	+config CRYPTO_GHASH_S390

Signed-off-by: Robert Elliott <elliott@....com>
---
 scripts/checkpatch.pl | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1b7a98adcaeb..d11d58e36ee9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1971,21 +1971,25 @@ sub raw_line {
 	$cnt++;
 
 	my $line;
+	my $consumed;
 	while ($cnt) {
 		$line = $rawlines[$offset++];
+		$consumed++;
 		next if (defined($line) && $line =~ /^-/);
 		$cnt--;
 	}
 
-	return $line;
+	return ($line, $consumed);
 }
 
 sub get_stat_real {
 	my ($linenr, $lc) = @_;
 
-	my $stat_real = raw_line($linenr, 0);
+	my ($stat_real, $consumed) = raw_line($linenr, 0);
 	for (my $count = $linenr + 1; $count <= $lc; $count++) {
-		$stat_real = $stat_real . "\n" . raw_line($count, 0);
+		my ($more, $consumed) = raw_line($count, 0);
+		$stat_real = $stat_real . "\n" . $more;
+		$count += $consumed - 1;
 	}
 
 	return $stat_real;
@@ -1996,7 +2000,8 @@ sub get_stat_here {
 
 	my $herectx = $here . "\n";
 	for (my $n = 0; $n < $cnt; $n++) {
-		$herectx .= raw_line($linenr, $n) . "\n";
+		my ($more, $consumed) = raw_line($linenr, $n);
+		$herectx .= $more . "\n";
 	}
 
 	return $herectx;
@@ -4323,7 +4328,7 @@ sub process {
 			}
 
 			my (undef, $sindent) = line_stats("+" . $s);
-			my $stat_real = raw_line($linenr, $cond_lines);
+			my ($stat_real, $consumed) = raw_line($linenr, $cond_lines);
 
 			# Check if either of these lines are modified, else
 			# this is not this patch's fault.
@@ -5420,7 +5425,7 @@ sub process {
 					$herectx = $here . "\n";
 					my $cnt = statement_rawlines($if_stat);
 					for (my $n = 0; $n < $cnt; $n++) {
-						my $rl = raw_line($linenr, $n);
+						my ($rl, $consumed) = raw_line($linenr, $n);
 						$herectx .=  $rl . "\n";
 						last if $rl =~ /^[ \+].*\{/;
 					}
@@ -5617,8 +5622,9 @@ sub process {
 				my $cond_lines = 1 + $#newlines;
 				my $stat_real = '';
 
-				$stat_real = raw_line($linenr, $cond_lines)
-							. "\n" if ($cond_lines);
+				my $consumed;
+				($stat_real, $consumed) = raw_line($linenr, $cond_lines)
+							           . "\n" if ($cond_lines);
 				if (defined($stat_real) && $cond_lines > 1) {
 					$stat_real = "[...]\n$stat_real";
 				}
@@ -7024,7 +7030,7 @@ sub process {
 			my $cnt = statement_rawlines($stat);
 			my $herectx = $here . "\n";
 			for (my $n = 0; $n < $cnt; $n++) {
-				my $rl = raw_line($linenr, $n);
+				my ($rl, $consumed) = raw_line($linenr, $n);
 				$herectx .=  $rl . "\n";
 				$ok = 1 if ($rl =~ /^[ \+]\{/);
 				$ok = 1 if ($rl =~ /\{/ && $n == 0);
-- 
2.38.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ