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>] [day] [month] [year] [list]
Message-ID: <1364839238.21627.66.camel@x61.thuisdomein>
Date:	Mon, 01 Apr 2013 20:00:38 +0200
From:	Paul Bolle <pebolle@...cali.nl>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH 4/8] headers_check: check kernel types inside #define

Kernel integer types are sometimes used inside defines too. Expand
check_kerneltypes() to notice these too.

Annoyingly, lines like
    #define VFIO_IRQ_SET_DATA_BOOL		(1 << 1) /* Data is bool (u8) */

force me to first strip oneline comments from the processed line. Both
regexes added here are just complicated enough to catch all current uses
of kernel integer types inside preprocessor #defines.

Signed-off-by: Paul Bolle <pebolle@...cali.nl>
---
 scripts/headers_check.pl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 317aa3a..dc7b34c 100644
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -163,7 +163,18 @@ sub check_sizetypes
 
 sub check_kerneltypes
 {
-	if ($line =~ m/^[[:space:]]*([us](8|16|32|64))\b/) {
+	my $match = 0;
+	# delete oneline comment
+	(my $scrubbed = $line) =~ s/\/\*.*\*\///;
+
+	if ($scrubbed =~ m/^[[:space:]]*([us](8|16|32|64))\b/) {
+		$match = 1;
+	} elsif ($scrubbed =~ m/# *define *.*\b([us](8|16|32|64))\b/) {
+		# matches lines like
+		#    #define BAR bar(MAGIC, u64)
+		$match = 1;
+	}
+	if ($match) {
 		printf STDERR "$filename:$lineno: " .
 		              "found $1 type exported to userspace; " .
 		              "use __$1 instead\n";
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ