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

From: Joe Perches
Date: Thu Mar 07 2024 - 12:50:39 EST


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.