* [PATCH] checkpatch: add check for missing */ in spdx line
@ 2026-02-04 21:38 Tim Bird
2026-02-04 22:21 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Tim Bird @ 2026-02-04 21:38 UTC (permalink / raw)
To: apw, joe, dwaipayanray1, lukas.bulwahn; +Cc: linux-spdx, linux-kernel, Tim Bird
Add an explicit check for leading /* but missing */
to avoid a malformed SPDX line.
In many cases an SPDX-License-Identifier line immediately
precedes another C-style comment. In that case, if
the SPDX line starts with '/*' but is missing the closing '*/',
the compiler may not catch it (the leading '/*' on
the next line and the rest of the header comment is just
treated as part of the SPDX comment).
Signed-off-by: Tim Bird <tim.bird@sony.com>
---
scripts/checkpatch.pl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a..1cc3fd5e72af 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3794,6 +3794,11 @@ sub process {
WARN("SPDX_LICENSE_TAG",
"Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
}
+ if ($comment eq '/*' &&
+ $rawline !~ m@\*/@) {
+ WARN("SPDX_LICENSE_TAG",
+ "Improper SPDX comment style for '$realfile', missing closing '*/'\n" . $herecurr);
+ }
if ($comment !~ /^$/ &&
$rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] checkpatch: add check for missing */ in spdx line
2026-02-04 21:38 [PATCH] checkpatch: add check for missing */ in spdx line Tim Bird
@ 2026-02-04 22:21 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2026-02-04 22:21 UTC (permalink / raw)
To: Tim Bird, apw, dwaipayanray1, lukas.bulwahn; +Cc: linux-spdx, linux-kernel
On Wed, 2026-02-04 at 14:38 -0700, Tim Bird wrote:
> Add an explicit check for leading /* but missing */
> to avoid a malformed SPDX line.
>
> In many cases an SPDX-License-Identifier line immediately
> precedes another C-style comment. In that case, if
> the SPDX line starts with '/*' but is missing the closing '*/',
> the compiler may not catch it (the leading '/*' on
> the next line and the rest of the header comment is just
> treated as part of the SPDX comment).
Nack. There too many existing uses.
$ git grep '^/\*.*SPDX' | grep -v '\*/'| wc -l
855
>
> Signed-off-by: Tim Bird <tim.bird@sony.com>
> ---
> scripts/checkpatch.pl | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index c0250244cf7a..1cc3fd5e72af 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3794,6 +3794,11 @@ sub process {
> WARN("SPDX_LICENSE_TAG",
> "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
> }
> + if ($comment eq '/*' &&
> + $rawline !~ m@\*/@) {
> + WARN("SPDX_LICENSE_TAG",
> + "Improper SPDX comment style for '$realfile', missing closing '*/'\n" . $herecurr);
> + }
>
> if ($comment !~ /^$/ &&
> $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-04 22:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-04 21:38 [PATCH] checkpatch: add check for missing */ in spdx line Tim Bird
2026-02-04 22:21 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®