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: <20220815041548.43744-4-elliott@hpe.com>
Date:   Sun, 14 Aug 2022 23:15:48 -0500
From:   Robert Elliott <elliott@....com>
To:     apw@...onical.com, joe@...ches.com, dwaipayanray1@...il.com,
        lukas.bulwahn@...il.com, linux-kernel@...r.kernel.org
Cc:     toshi.kani@....com, Robert Elliott <elliott@....com>
Subject: [PATCH 3/3] checkpatch: check line length in Kconfig help text

Apply the normal --max-line-length=nn line length checks to
Kconfig help text.

The default of 100 is only triggered by one existing line in
a file named Kconfig. Running with --max-line-length=80 reports
only a few long lines:
- 11 between 90 and 99 characters
- 25 betwen 81 and 89 characters
9 of which are due to long URLs.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4d09a324a586..f8e48af40b81 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3495,7 +3495,7 @@ sub process {
 				next if ($f =~ /^-/);
 				last if ($f !~ /^[\+ ]/);	# !patch context
 
-				if ($f =~ /^[\+ ]\s*(?:bool|tristate|prompt)\s*["']/) {
+				if ($f =~ /^[\+ ]\s*(?:bool|tristate|string|hex|int|prompt)\s*["']/) {
 					$needs_help = 1;
 					next;
 				}
@@ -3514,12 +3514,27 @@ sub process {
 				# and so hopefully shouldn't trigger false
 				# positives, even though some of these are
 				# common words in help texts
-				if ($f =~ /^(?:config|menuconfig|choice|endchoice|
-					       if|endif|menu|endmenu|source)\b/x) {
+				if ($f =~ /^(?:config|menuconfig|
+					       choice|endchoice|
+					       comment|if|endif|
+					       menu|endmenu|source)\b/x) {
 					last;
 				}
+
+				# no further checking for lines with these keywords
+				if ($f =~ /^(?:default|def_bool|depends|select|imply)\b/x) {
+					next;
+				}
+
+				my ($length, $indent) = line_stats($f);
+				if ($length > $max_line_length) {
+					WARN("CONFIG_DESCRIPTION",
+					     "Kconfig help text line length ($length) too long: $f\n");
+				}
+
 				$help_length++ if ($has_help);
 			}
+
 			if ($needs_help &&
 			    $help_length < $min_conf_desc_length) {
 				my $stat_real = get_stat_real($linenr, $ln - 1);
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ