mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c
@ 2024-03-06  9:33 Lukas Bulwahn
  2024-03-06 15:08 ` Dan Carpenter
  2024-03-07 17:13 ` Joe Perches
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2024-03-06  9:33 UTC (permalink / raw)
  To: Joe Perches; +Cc: kernel-janitors, Linux Kernel Mailing List

Dear Joe,

while running checkpatch.pl -f on all files in the kernel repository
(v6.8-rc1) for some experiment, I noticed that checkpatch.pl got stuck
on mm/kmsan/kmsan_test.c, i.e., ./scripts/checkpatch.pl -f
mm/kmsan/kmsan_test.c never terminates.

I could already boil it down to checkpatch getting stuck on the macro
#define DEFINE_TEST_MEMSETXX(size), see lines 541 to 554 in
mm/kmsan/kmsan_test.c on v6.8-rc1.

I do not know if it is worth fixing, but certainly I was surprised
that reasonable code can put checkpatch into some stuck state.

Best regards,

Lukas

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

* Re: checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c
  2024-03-06  9:33 checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c Lukas Bulwahn
@ 2024-03-06 15:08 ` Dan Carpenter
  2024-03-07 17:13 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-03-06 15:08 UTC (permalink / raw)
  To: Lukas Bulwahn, Andy Whitcroft
  Cc: Joe Perches, kernel-janitors, Linux Kernel Mailing List

On Wed, Mar 06, 2024 at 10:33:55AM +0100, Lukas Bulwahn wrote:
> Dear Joe,
> 
> while running checkpatch.pl -f on all files in the kernel repository
> (v6.8-rc1) for some experiment, I noticed that checkpatch.pl got stuck
> on mm/kmsan/kmsan_test.c, i.e., ./scripts/checkpatch.pl -f
> mm/kmsan/kmsan_test.c never terminates.
> 
> I could already boil it down to checkpatch getting stuck on the macro
> #define DEFINE_TEST_MEMSETXX(size), see lines 541 to 554 in
> mm/kmsan/kmsan_test.c on v6.8-rc1.
> 
> I do not know if it is worth fixing, but certainly I was surprised
> that reasonable code can put checkpatch into some stuck state.

I think the bug is ancient...  Here is a stupid solution.  But afterward
it still prints a ton of Perl warnings:

substr outside of string at ./scripts/checkpatch.pl line 5158.
Use of uninitialized value $op_type in string ne at ./scripts/checkpatch.pl line 5164.
substr outside of string at ./scripts/checkpatch.pl line 5158.
Use of uninitialized value $op_type in string ne at ./scripts/checkpatch.pl line 5164.

regards,
dan carpenter

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c4c4a61bc83..bd7a286bc1ce 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2260,10 +2260,14 @@ sub annotate_values {
 		} elsif ($cur =~ /(^.)/o) {
 			print "C($1)\n" if ($dbg_values > 1);
 		}
+		my $old = $cur;
 		if (defined $1) {
 			$cur = substr($cur, length($1));
 			$res .= $type x length($1);
 		}
+		if ($old eq $cur) {
+			last;
+		}
 	}
 
 	return ($res, $var);



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

* Re: checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c
  2024-03-06  9:33 checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c Lukas Bulwahn
  2024-03-06 15:08 ` Dan Carpenter
@ 2024-03-07 17:13 ` Joe Perches
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2024-03-07 17:13 UTC (permalink / raw)
  To: Lukas Bulwahn, Dan Carpenter; +Cc: kernel-janitors, Linux Kernel Mailing List

On Wed, 2024-03-06 at 10:33 +0100, Lukas Bulwahn wrote:
> Dear Joe,
> 
> while running checkpatch.pl -f on all files in the kernel repository
> (v6.8-rc1) for some experiment, I noticed that checkpatch.pl got stuck
> on mm/kmsan/kmsan_test.c, i.e., ./scripts/checkpatch.pl -f
> mm/kmsan/kmsan_test.c never terminates.
> 
> I could already boil it down to checkpatch getting stuck on the macro
> #define DEFINE_TEST_MEMSETXX(size), see lines 541 to 554 in
> mm/kmsan/kmsan_test.c on v6.8-rc1.
> 
> I do not know if it is worth fixing, but certainly I was surprised
> that reasonable code can put checkpatch into some stuck state.
> 

I know why it hangs.  I'll give it a think for a bit.
I rather doubt Dan's suggestion is the appropriate one.

Code is:

		volatile uint##size##_t
uninit;			\

and in checkpatch line 2304:

			$possible =~ s/\s*$Type\s*//g;

where uint is a $Type it removes.


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

end of thread, other threads:[~2024-03-07 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06  9:33 checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c Lukas Bulwahn
2024-03-06 15:08 ` Dan Carpenter
2024-03-07 17:13 ` 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®