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:	Mon, 22 Oct 2012 06:16:43 -0700
From:	Joe Perches <joe@...ches.com>
To:	Peter Hurley <peter@...leysoftware.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Whitcroft <apw@...onical.com>
Cc:	David Howells <dhowells@...hat.com>,
	Ken O'Brien <kernel@...obrien.org>, gregkh@...uxfoundation.org,
	swetland@...gle.com, arve@...roid.com, viro@...iv.linux.org.uk,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] checkpatch: Warn on unnecessary line continuations

Line continuations are not normal kernel style.
Bleat a warning when used outside of a macro definition.

Signed-off-by: Joe Perches <joe@...ches.com>
---

On Mon, 2012-10-22 at 09:02 -0400, Peter Hurley wrote:
> On Mon, 2012-10-22 at 05:15 -0700, Joe Perches wrote:
> > waOn Mon, 2012-10-22 at 10:37 +0100, David Howells wrote:
> > > Joe Perches <joe@...ches.com> wrote:
> > > 
> > > > On Sat, 2012-10-20 at 23:33 +0100, Ken O'Brien wrote:
> > > > ...
> > > > > -		pr_err("binder: %d: binder_alloc_buf failed to "
> > > > > +		pr_err("binder: %d: binder_alloc_buf failed to " \
> > > > >  		       "map pages in userspace, no vma\n", proc->pid);
> > > > ...
> > > > Nice try, but the "right" way to do this is to coalesce formats like:
> > > > 
> > > > 		pr_err("binder: %d: binder_alloc_buf failed to map pages in userspace, no vma\n",
> > > > 		       proc->pid);
> > > 
> > > Surely the right way is to fix _checkpatch_ to see ["]\n\s*["] and merge the
> > > lines before checking them?  We shouldn't have to fix up the source in either
> > > of these fashions just because checkpatch is broken.
> > 
> > checkpatch is stupid, but it's not broken here.
> > 
> > Formats should be coalesced into a single line to make
> > grepping the source for dmesg output easier.
> 
> But MODULE_PARM_DESC() multi-line strings are ok, right?
> 

I don't think so.
Maybe this patch:

 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..d4ea29a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3011,6 +3011,14 @@ sub process {
 					      "Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
 				}
 			}
+
+# check for line continuations outside of #defines
+
+		} else {
+			if ($line =~ /^\+.*\\$/) {
+				WARN("LINE_CONTINUATIONS",
+				     "Avoid unnecessary line continuations\n" . $herecurr);
+			}
 		}
 
 # do {} while (0) macro tests:


--
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