mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Improve ALLOC_ARRAY_ARGS test
@ 2021-04-16 15:58 Christophe JAILLET
  2021-04-16 16:11 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2021-04-16 15:58 UTC (permalink / raw)
  To: apw, joe, dwaipayanray1, lukas.bulwahn
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

The devm_ variant of 'kcalloc()' and 'kmalloc_array()' are not tested
Add the corresponding check.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 44b9dc330ac6..c778edfdbad7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7006,9 +7006,9 @@ 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);
+			     "$1$2 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
 		}
 
 # check for multiple semicolons
-- 
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-16 18:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 15:58 [PATCH] checkpatch: Improve ALLOC_ARRAY_ARGS test Christophe JAILLET
2021-04-16 16:11 ` Joe Perches
2021-04-16 16:51   ` Christophe JAILLET
2021-04-16 17:03     ` Joe Perches
2021-04-16 18:03       ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®