summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-03-23 15:02:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-23 16:58:36 -0700
commit6061d949dd984c762ee272a88e77699fa675d1c8 (patch)
tree2e19eecd34a716fc5ed9fa3f18a7db0a3edf6f5b /scripts/checkpatch.pl
parent97e834c5040b85e133d8d922111a62b2b853a406 (diff)
include/ and checkpatch: prefer __scanf to __attribute__((format(scanf,...)
It's equivalent to __printf, so prefer __scanf. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a3b9782441f9..89d24b3ea438 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3123,6 +3123,12 @@ sub process {
"__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr);
}
+# Check for __attribute__ format(scanf, prefer __scanf
+ if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) {
+ WARN("PREFER_SCANF",
+ "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr);
+ }
+
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("SIZEOF_ADDRESS",