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: <Pine.LNX.4.62.0705021626080.3706@pademelon.sonytel.be>
Date:	Wed, 2 May 2007 16:28:27 +0200 (CEST)
From:	Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com>
To:	Dave Jones <davej@...hat.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	linux-kernel@...r.kernel.org
Subject: Re: checkpatch, a patch checking script.

On Fri, 27 Apr 2007, Dave Jones wrote:
> On Wed, Apr 25, 2007 at 08:02:07PM -0700, Andrew Morton wrote:
>  > > Yep, I was going to mention your scripts but you beat me to it.
>  > > 
>  > > I'll be glad to help maintain such animals if wanted.
>  > > 
>  > wanted ;)
>  > 
>  > At least, it would be interesting to investigate the usefulness.  I suspect
>  > it will prove to be very useful for the little things.
> 
> Randy and I got together and hashed out a first cut at this.
> (Randy actually gutted quite a lot of what I originally wrote, so deserves
>  much kudos for improving this beyond my initial crappy version).
> You can find the script at http://www.codemonkey.org.uk/projects/checkpatch/
> There's also a git clonable tree there (only http right now).
> 
> http://www.codemonkey.org.uk/projects/checkpatch/example.log shows
> what fell out of running it on my mbox of lkml from the past month.
> Some of them are kinda noisy, and perhaps should be moved under --pedantic
> 
> I'm all ears for additional regexps, bug reports or other suggestions.

Nice!

Here are a few more:
  - Check for all of (u)int{8,16,32,64}_t
  - Check for GNU extension __FUNCTION__
  - Don't use space before tab
  - Don't use trailing white space

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com>

diff --git a/checkpatch.pl b/checkpatch.pl
index cbda29a..b44a3f3 100755
--- a/checkpatch.pl
+++ b/checkpatch.pl
@@ -143,10 +143,26 @@ sub process {
 			"Bad variable name: tmp. Please use something more descriptive.\n");
 		$warnings += search(qr/temp(,|;)/,
 			"Bad variable name: temp. Please use something more descriptive.\n");
+		$warnings += search(qr/uint8_t/,
+			"Incorrect type usage for kernel code. Use __u8/u8\n");
+		$warnings += search(qr/uint16_t/,
+			"Incorrect type usage for kernel code. Use __u16/u16\n");
 		$warnings += search(qr/uint32_t/,
-			"Incorrect type usage for kernel code. Use __u32 etc.\n");
+			"Incorrect type usage for kernel code. Use __u32/u32\n");
+		$warnings += search(qr/uint64_t/,
+			"Incorrect type usage for kernel code. Use __u64/u64\n");
+		$warnings += search(qr/int8_t/,
+			"Incorrect type usage for kernel code. Use __s8/s8\n");
+		$warnings += search(qr/int16_t/,
+			"Incorrect type usage for kernel code. Use __s16/s16\n");
+		$warnings += search(qr/int32_t/,
+			"Incorrect type usage for kernel code. Use __s32/s32\n");
+		$warnings += search(qr/int64_t/,
+			"Incorrect type usage for kernel code. Use __s64/s64\n");
 		$warnings += search(qr/\b(BUG|BUG_ON)\b/,
 			"Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n");
+		$warnings += search(qr/__FUNCION__/,
+			"Should use C99 __func__ instead of GNU __FUNCTION__\n");
 	}
 
 	# coding style:
@@ -154,6 +170,8 @@ sub process {
 		$warnings += search(qr/,[^[:space:]]/, "Need space after comma:\n");
 		$warnings += search(qr/\([[:space:]]/, "Don't use space after '(':\n");
 		$warnings += search(qr/[[:space:]]\)/, "Don't use space before ')':\n");
+		$warnings += search(qr/ \t/, "Don't use space before tab:\n");
+		$warnings += search(qr/[[:space:]]$/, "Don't use trailing white space:\n");
 		$warnings += search(qr/if\(|for\(|while\(|switch\(/,
 				"Need space after if/for/while/switch:\n");
 		$warnings += search(qr/sizeof[[:space:]]/,

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven@...ycom.com ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium
-
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