diff options
author | Liao Chang <liaochang1@huawei.com> | 2022-11-04 08:05:23 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-12-01 01:13:16 +0100 |
commit | 3965292ad0ca70320f1c632f2ac3b886c88b9e80 (patch) | |
tree | e12b81168e39c29102ba566dd43238c872830a0f /scripts/checkpatch.pl | |
parent | wifi: rt2x00: use explicitly signed or unsigned types (diff) | |
download | linux-3965292ad0ca70320f1c632f2ac3b886c88b9e80.tar.xz linux-3965292ad0ca70320f1c632f2ac3b886c88b9e80.zip |
checkpatch: add check for array allocator family argument order
These array allocator family are sometimes misused with the first and
second arguments switched.
Same issue with calloc, kvcalloc, kvmalloc_array etc.
Bleat if sizeof is the first argument.
Link: https://lore.kernel.org/lkml/5374345c-7973-6a3c-d559-73bf4ac15079@redhat.com/
Link: https://lkml.kernel.org/r/20221104070523.60296-1-liaochang1@huawei.com
Signed-off-by: Liao Chang <liaochang1@huawei.com>
Acked-by: Joe Perches <joe@perches.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 29517897baa1..78cc595b98ce 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7146,7 +7146,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); } |