mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>,
	kernel-janitors <kernel-janitors@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: checkpatch.pl getting stuck on a macro in mm/kmsan/kmsan_test.c
Date: Wed, 6 Mar 2024 18:08:59 +0300	[thread overview]
Message-ID: <2bac2cd3-ccdc-413f-aae7-110b5c36122a@moroto.mountain> (raw)
In-Reply-To: <CAKXUXMwCdV466mRd4K0ePV73qDO9GRAph4KuC5nQ0JAp-ouemQ@mail.gmail.com>

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



  reply	other threads:[~2024-03-06 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  9:33 Lukas Bulwahn
2024-03-06 15:08 ` Dan Carpenter [this message]
2024-03-07 17:13 ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bac2cd3-ccdc-413f-aae7-110b5c36122a@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®