linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts: headers_install: fix a false positive
@ 2025-05-13 16:00 Wen Yang
  2025-05-15 11:32 ` Nicolas Schier
  0 siblings, 1 reply; 4+ messages in thread
From: Wen Yang @ 2025-05-13 16:00 UTC (permalink / raw)
  To: Masahiro Yamada, ndrew Morton
  Cc: Nicolas Schier, Miguel Ojeda, linux-kernel, Wen Yang

The current implementation only handles C89 style comments (/*... */) in
the code, and there are false positives for C99 style comments (//...).

This patch fixes this issue.

Signed-off-by: Wen Yang <wen.yang@linux.dev>
---
 scripts/headers_install.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 6bbccb43f7e7..41722bcc8668 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
 # Remove /* ... */ style comments, and find CONFIG_ references in code
 configs=$(sed -e '
 :comment
+	s://.*::
 	s:/\*[^*][^*]*:/*:
 	s:/\*\*\**\([^/]\):/*\1:
 	t comment
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts: headers_install: fix a false positive
  2025-05-13 16:00 [PATCH] scripts: headers_install: fix a false positive Wen Yang
@ 2025-05-15 11:32 ` Nicolas Schier
  2025-05-16 15:45   ` Wen Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Schier @ 2025-05-15 11:32 UTC (permalink / raw)
  To: Wen Yang; +Cc: Masahiro Yamada, Andrew Morton, Miguel Ojeda, linux-kernel

On Wed, May 14, 2025 at 12:00:56AM +0800, Wen Yang wrote:
> The current implementation only handles C89 style comments (/*... */) in
> the code, and there are false positives for C99 style comments (//...).
> 
> This patch fixes this issue.
> 
> Signed-off-by: Wen Yang <wen.yang@linux.dev>
> ---
>  scripts/headers_install.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> index 6bbccb43f7e7..41722bcc8668 100755
> --- a/scripts/headers_install.sh
> +++ b/scripts/headers_install.sh
> @@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
>  # Remove /* ... */ style comments, and find CONFIG_ references in code
>  configs=$(sed -e '
>  :comment
> +	s://.*::
>  	s:/\*[^*][^*]*:/*:
>  	s:/\*\*\**\([^/]\):/*\1:
>  	t comment
> -- 
> 2.25.1

thanks.  The patch looks good to me, but I cannot find any false
positives.  Have you found any concrete?

Kind regards,
Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts: headers_install: fix a false positive
  2025-05-15 11:32 ` Nicolas Schier
@ 2025-05-16 15:45   ` Wen Yang
  2025-06-30 13:11     ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Wen Yang @ 2025-05-16 15:45 UTC (permalink / raw)
  To: Nicolas Schier; +Cc: Masahiro Yamada, Andrew Morton, Miguel Ojeda, linux-kernel



On 5/15/25 19:32, Nicolas Schier wrote:
> On Wed, May 14, 2025 at 12:00:56AM +0800, Wen Yang wrote:
>> The current implementation only handles C89 style comments (/*... */) in
>> the code, and there are false positives for C99 style comments (//...).
>>
>> This patch fixes this issue.
>>
>> Signed-off-by: Wen Yang <wen.yang@linux.dev>
>> ---
>>   scripts/headers_install.sh | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
>> index 6bbccb43f7e7..41722bcc8668 100755
>> --- a/scripts/headers_install.sh
>> +++ b/scripts/headers_install.sh
>> @@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
>>   # Remove /* ... */ style comments, and find CONFIG_ references in code
>>   configs=$(sed -e '
>>   :comment
>> +	s://.*::
>>   	s:/\*[^*][^*]*:/*:
>>   	s:/\*\*\**\([^/]\):/*\1:
>>   	t comment
>> -- 
>> 2.25.1
> 
> thanks.  The patch looks good to me, but I cannot find any false
> positives.  Have you found any concrete?
> 

Thanks. We have enhanced dmabuf on our SoC platform and modified the 
include/uapi/linux/dma-buf.h file, and then found this issue.

--
Best wishes,
Wen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scripts: headers_install: fix a false positive
  2025-05-16 15:45   ` Wen Yang
@ 2025-06-30 13:11     ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2025-06-30 13:11 UTC (permalink / raw)
  To: Wen Yang; +Cc: Nicolas Schier, Andrew Morton, Miguel Ojeda, linux-kernel

On Sat, May 17, 2025 at 12:45 AM Wen Yang <wen.yang@linux.dev> wrote:
>
>
>
> On 5/15/25 19:32, Nicolas Schier wrote:
> > On Wed, May 14, 2025 at 12:00:56AM +0800, Wen Yang wrote:
> >> The current implementation only handles C89 style comments (/*... */) in
> >> the code, and there are false positives for C99 style comments (//...).
> >>
> >> This patch fixes this issue.
> >>
> >> Signed-off-by: Wen Yang <wen.yang@linux.dev>
> >> ---
> >>   scripts/headers_install.sh | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> >> index 6bbccb43f7e7..41722bcc8668 100755
> >> --- a/scripts/headers_install.sh
> >> +++ b/scripts/headers_install.sh
> >> @@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
> >>   # Remove /* ... */ style comments, and find CONFIG_ references in code
> >>   configs=$(sed -e '
> >>   :comment
> >> +    s://.*::
> >>      s:/\*[^*][^*]*:/*:
> >>      s:/\*\*\**\([^/]\):/*\1:
> >>      t comment
> >> --
> >> 2.25.1
> >
> > thanks.  The patch looks good to me, but I cannot find any false
> > positives.  Have you found any concrete?
> >
>
> Thanks. We have enhanced dmabuf on our SoC platform and modified the
> include/uapi/linux/dma-buf.h file, and then found this issue.

The SPDX License Identifier in UAPI headers use
/* ... */, and never C++ style comments.

In my understanding, the idea behind this is
UAPI headers follow more strict C.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-30 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 16:00 [PATCH] scripts: headers_install: fix a false positive Wen Yang
2025-05-15 11:32 ` Nicolas Schier
2025-05-16 15:45   ` Wen Yang
2025-06-30 13:11     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).