Re: checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux