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]
Date: Tue, 16 Apr 2024 11:59:43 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Prasad Pandit <pj.pandit@...oo.in>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Joe Perches <joe@...ches.com>,
	Dwaipayan Ray <dwaipayanray1@...il.com>,
	Lukas Bulwahn <lukas.bulwahn@...il.com>,
	Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: error if file terminates without a new-line

On Tue, Apr 16, 2024 at 10:48:27AM +0200, Greg KH wrote:
> > 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).");
> > +        }
> 
> Why is this a problem?  files without a new line should not cause
> problems with a compiler, right?  You don't have a justification for why
> this change needs to be checked for anywhere.
> 

I gave him such a good reason too...  It breaks `cat file.c`.  Plus, it
looks weird in `git log -p` because it has a "No newline at the end of
file" comment.

regards,
dan carpenter

diff --git a/test.c b/test.c
new file mode 100644
index 000000000000..d808cac2d962
--- /dev/null
+++ b/test.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <stdbool.h>
+#include "check_debug.h"
+
+void kfree(int *p);
+
+int *p;
+int main(void)
+{
+       kfree(p);
+       *p = 1;
+}
\ No newline at end of file

commit f4a997924122d0094675c897a220371f0a129d90





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ