Skip to content

Commit

Permalink
checkpatch.pl: fix CAST detection
Browse files Browse the repository at this point in the history
We should only claim that something is a cast if we did not encouter a
token before, that did set av_pending.

This fixes the operator * in the line below to be detected as binary (vs
unary).

kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);

Reported-by: Audun Hoem <[email protected]>
Signed-off-by: Florian Mickler <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
FlorianMickler authored and torvalds committed Jan 13, 2011
1 parent caf2a54 commit c023e47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ sub annotate_values {
$av_preprocessor = 0;
}

} elsif ($cur =~ /^(\(\s*$Type\s*)\)/) {
} elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
print "CAST($1)\n" if ($dbg_values > 1);
push(@av_paren_type, $type);
$type = 'C';
Expand Down

0 comments on commit c023e47

Please sign in to comment.