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]
Message-ID: <20071217071105.GA10869@gollum.tnic>
Date:	Mon, 17 Dec 2007 08:11:05 +0100
From:	Borislav Petkov <bbpetkov@...oo.de>
To:	apw@...dowen.org, rdunlap@...otime.net, jschopp@...tin.ibm.com
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] scripts/checkpatch.pl: add a check for the patch level
	(patch -p<num>)

Being bitten by this several times myself here's a quick hack for checking the patch
level of the diffs in a patch file. It works only when checkpatch.pl is called
from within the kernel tree.

---
Signed-off-by: Borislav Petkov <bbpetkov@...oo.de>

--
 scripts/checkpatch.pl |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 579f50f..b1329fc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -653,6 +653,18 @@ sub CHK {
 	}
 }
 
+sub check_patchlevel {
+
+	my ($path) = @_;
+	$path =~ s![^/]*/!!;
+
+	if ($tree) {
+		if (!stat($path)) {
+			WARN("Check the patchlevel (hint: patch option -p)");
+		}
+	}
+}
+
 sub process {
 	my $filename = shift;
 	my @lines = @_;
@@ -713,10 +725,16 @@ sub process {
 #extract the filename as it passes
 		if ($line=~/^\+\+\+\s+(\S+)/) {
 			$realfile=$1;
+
+			if ($realfile) {
+				check_patchlevel($realfile);
+			}
+
 			$realfile =~ s@^[^/]*/@@;
 			$in_comment = 0;
 			next;
 		}
+
 #extract the line range in the file after the patch is applied
 		if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
 			$is_patch = 1;

-- 
Regards/Gruß,
    Boris.
--
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