lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Mar 2023 15:28:12 +0100
From:   Alexander Potapenko <glider@...gle.com>
To:     apw@...onical.com, Joe Perches <joe@...ches.com>,
        dwaipayanray1@...il.com, Lukas Bulwahn <lukas.bulwahn@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Infinite loop in checkpatch.pl

Hi folks,

I've noticed that checkpatch.pl chokes on the following file (also attached):

==================================
$ cat test-checkpatch.txt
diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c
@@ -504,6 +504,25 @@ static void
test_memcpy_aligned_to_unaligned2(struct kunit *test)
+ EXPECTATION_NO_REPORT(expect);                              \
+ volatile uint##size##_t uninit;                             \
==================================


, getting into an infinite loop in annotate_values().
The following patch helps it to proceed:

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 78cc595b98ce1..01d998b416a51 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2240,8 +2240,13 @@ sub annotate_values {
                        print "C($1)\n" if ($dbg_values > 1);
                }
                if (defined $1) {
-                       $cur = substr($cur, length($1));
-                       $res .= $type x length($1);
+                       if (length($1)) {
+                               $cur = substr($cur, length($1));
+                               $res .= $type x length($1);
+                       } else {
+                               $res .= $cur;
+                               $cur = "";
+                       }
                }
        }

, but I have no idea how to test it properly.

Could you please take a look?


Thanks,
Alex

-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

View attachment "test-checkpatch.txt" of type "text/plain" (276 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ