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]
Message-ID: <20221104040020.16389-1-liaochang1@huawei.com>
Date:   Fri, 4 Nov 2022 12:00:20 +0800
From:   Liao Chang <liaochang1@...wei.com>
To:     <apw@...onical.com>, <joe@...ches.com>, <dwaipayanray1@...il.com>,
        <lukas.bulwahn@...il.com>
CC:     <linux-kernel@...r.kernel.org>, <liaochang1@...wei.com>,
        <bagasdotme@...il.com>, <pbonzini@...hat.com>
Subject: [PATCH] checkpatch: Add check for array allocator family argument order

These array allocator family are sometimes misused with the first and
second arguments switchted.

Same issue with calloc, kvcalloc, kvmalloc_array etc.

Bleat if sizeof is the first argument.

Link: https://lkml.org/lkml/2022/11/3/668
Signed-off-by: Liao Chang <liaochang1@...wei.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1e5e66ae5a52..a9a9dc277cff 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7128,7 +7128,7 @@ sub process {
 		}
 
 # check for alloc argument mismatch
-		if ($line =~ /\b((?:devm_)?(?:kcalloc|kmalloc_array))\s*\(\s*sizeof\b/) {
+		if ($line =~ /\b((?:devm_)?((?:k|kv)?(calloc|malloc_array)(?:_node)?))\s*\(\s*sizeof\b/) {
 			WARN("ALLOC_ARRAY_ARGS",
 			     "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
 		}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ