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] [day] [month] [year] [list]
Message-ID: <86bce3b4176ac83c4d4c82c38bf2e8eac5983b1c.camel@perches.com>
Date:   Sat, 19 Mar 2022 19:30:22 -0700
From:   Joe Perches <joe@...ches.com>
To:     Paul Menzel <pmenzel@...gen.mpg.de>,
        Andy Whitcroft <apw@...onical.com>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Re: Checking for space before ending comment tag

Maybe this is better as it can fix them too.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 577e029987011..70afa4ff2addf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3868,6 +3868,22 @@ sub process {
 			}
 		}
 
+# Single line comment style - warn when '/*comment */' or '/* comment*/'
+		if ($line =~ /^\+.*$;/ &&
+		    $rawline =~ m@/\*.+\*/@ &&
+		    (($rawline =~ m@/\* @  && $rawline =~ m@\w\*/@) ||
+		     ($rawline =~ m@/\*\w@ && $rawline =~ m@ \*/@))) {
+			if (WARN("COMMENT_STYLE",
+				 "Single line comments should use a space after /* and before */\n" . $herecurr) &&
+			    $fix) {
+				$rawline =~ m@/\*.+\*/@;
+				my $comment = substr($rawline, $-[0], $+[0] - $-[0]);
+				my $newcomment = trim(substr($comment, 2, -2));
+				$fixed[$fixlinenr] =~
+				    s@\Q$comment\E@/\* $newcomment \*/@;
+			}
+		}
+
 # Block comment styles
 # Networking with an initial /*
 		if ($realfile =~ m@^(drivers/net/|net/)@ &&

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ