Skip to content

Commit 4cab63c

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: fix krealloc reuse test
The current krealloc test does not function correctly when the temporary pointer return name contains the original pointer name. Fix that by maximally matching the return pointer name and the original pointer name and doing a separate comparison of the both names. Link: http://lkml.kernel.org/r/e617ecb8c019a9c4c56540a1bec16c8aed43a4e4.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Manish Narani <manish.narani@xilinx.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3b6e8ac commit 4cab63c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎scripts/checkpatch.pl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6167,7 +6167,8 @@ sub process {
61676167

61686168
# check for krealloc arg reuse
61696169
if ($perl_version_ok &&
6170-
$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
6170+
$line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
6171+
$1 eq $3) {
61716172
WARN("KREALLOC_ARG_REUSE",
61726173
"Reusing the krealloc arg is almost always a bug\n" . $herecurr);
61736174
}

0 commit comments

Comments
 (0)