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-next>] [day] [month] [year] [list]
Date: Thu, 14 Dec 2023 16:14:51 -0800
From: Kees Cook <keescook@...omium.org>
To: Jonathan Corbet <corbet@....net>
Cc: Kees Cook <keescook@...omium.org>,
	linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org
Subject: [PATCH] scripts: kernel-doc: Report excess struct member descriptions

While missing descriptions were already be reported, missing struct
members were not. For example, previously this output was empty, but now
produces:

$ ./scripts/kernel-doc -none ./drivers/leds/leds-mlxreg.c
./drivers/leds/leds-mlxreg.c:42: warning: Excess struct member 'led_data' description in 'mlxreg_led_data'

Cc: Jonathan Corbet <corbet@....net>
Cc: linux-doc@...r.kernel.org
Signed-off-by: Kees Cook <keescook@...omium.org>
---
 scripts/kernel-doc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 08a3e603db19..39e730ee1fef 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1265,6 +1265,18 @@ sub dump_struct($$) {
 		$declaration .= "\t" . $clause . "\n";
 		$level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
 	}
+
+	my %_members;
+	$_members{$_}++ for (@parameterlist);
+
+	while (my ($k, $v) = each %parameterdescs) {
+	    if (!exists($_members{$k})) {
+	        if (show_warnings("struct", $declaration_name)) {
+		     emit_warning("${file}:$.", "Excess struct member '$k' description in '$declaration_name'\n");
+		}
+	    }
+	}
+
 	output_declaration($declaration_name,
 			   'struct',
 			   {'struct' => $declaration_name,
-- 
2.34.1


Powered by blists - more mailing lists