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: Tue, 16 Apr 2024 07:04:47 +0000 (UTC)
From: Prasad Pandit <pjp@...oraproject.org>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Joe Perches <joe@...ches.com>, Dwaipayan Ray <dwaipayanray1@...il.com>, 
	Lukas Bulwahn <lukas.bulwahn@...il.com>, 
	Dan Carpenter <dan.carpenter@...aro.org>, 
	Greg KH <gregkh@...uxfoundation.org>, 
	Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: error if file terminates without a new-line

[+linux-kernel]

On Saturday, 30 March, 2024 at 09:09:12 am IST, Prasad Pandit <ppandit@...hat.com> wrote: 
From: Prasad Pandit <pjp@...oraproject.org>

Add check to flag an error if a patch terminates a file
without a new line (\n) character.

Suggested-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Prasad Pandit <pjp@...oraproject.org>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)

-> https://lore.kernel.org/all/CAE8KmOxG=3sWKpeB5fdWTK-SCipS=JyDE-_DNgY--DtoSQZ0Qw@mail.gmail.com/T/#t

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c4c4a61bc83..df34c0709410 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2795,6 +2795,13 @@ sub process {
            $is_patch = 1;
        }

+# check if patch terminates file without a new line (\n)
+        if ($line =~ /^\\ No newline at end of file$/
+            and $rawlines[$linenr - 2] =~ /^\+.*$/) {
+            ERROR("NOEOL_FILE",
+                  "patch terminates file without a new line (\\n).");
+        }
+
#extract the line range in the file after the patch is applied
        if (!$in_commit_log &&
            $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
-- 
2.44.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ