Re: [PATCH] checkpatch: add check for missing */ in spdx line

Joe Perches <[email protected]> Wed, 04 Feb 2026 14:21:10 -0800
Newsgroups org.kernel.vger.linux-spdx,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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.
>=20
> 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

>=20
> Signed-off-by: Tim Bird <[email protected]>
> ---
>  scripts/checkpatch.pl | 5 +++++
>  1 file changed, 5 insertions(+)
>=20
> 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 '$com=
ment' instead\n" . $herecurr);
>  				}
> +				if ($comment eq '/*' &&
> +				    $rawline !~ m@\*/@) {
> +					WARN("SPDX_LICENSE_TAG",
> +					     "Improper SPDX comment style for '$realfile', missing closing =
'*/'\n" . $herecurr);
> +				}
> =20
>  				if ($comment !~ /^$/ &&
>  				    $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {