diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1eb5d2fa8d20..61090e0ff613 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -4019,6 +4019,23 @@ sub process { | |||
4019 | } | 4019 | } |
4020 | } | 4020 | } |
4021 | 4021 | ||
4022 | # check for naked sscanf | ||
4023 | if ($^V && $^V ge 5.10.0 && | ||
4024 | defined $stat && | ||
4025 | $stat =~ /\bsscanf\b/ && | ||
4026 | ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ && | ||
4027 | $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ && | ||
4028 | $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) { | ||
4029 | my $lc = $stat =~ tr@\n@@; | ||
4030 | $lc = $lc + $linenr; | ||
4031 | my $stat_real = raw_line($linenr, 0); | ||
4032 | for (my $count = $linenr + 1; $count <= $lc; $count++) { | ||
4033 | $stat_real = $stat_real . "\n" . raw_line($count, 0); | ||
4034 | } | ||
4035 | WARN("NAKED_SSCANF", | ||
4036 | "unchecked sscanf return value\n" . "$here\n$stat_real\n"); | ||
4037 | } | ||
4038 | |||
4022 | # check for new externs in .h files. | 4039 | # check for new externs in .h files. |
4023 | if ($realfile =~ /\.h$/ && | 4040 | if ($realfile =~ /\.h$/ && |
4024 | $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { | 4041 | $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { |