From: Christophe JAILLET Date: Fri, 7 May 2021 01:04:01 +0000 (-0700) Subject: checkpatch: improve ALLOC_ARRAY_ARGS test X-Git-Tag: v5.15~1165^2~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e6cdd7fd94380a3b87b2ce087903b3722b3d0d6;p=platform%2Fkernel%2Flinux-starfive.git checkpatch: improve ALLOC_ARRAY_ARGS test The devm_ variant of 'kcalloc()' and 'kmalloc_array()' are not tested Add the corresponding check. Link: https://lkml.kernel.org/r/205fc4847972fb6779abcc8818f39c14d1b45af1.1618595794.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET Acked-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 44b9dc3..23697a6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7006,7 +7006,7 @@ sub process { } # check for alloc argument mismatch - if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { + if ($line =~ /\b((?:devm_)?(?:kcalloc|kmalloc_array))\s*\(\s*sizeof\b/) { WARN("ALLOC_ARRAY_ARGS", "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr); }