summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-03-23 23:02:16 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-24 00:58:36 +0100
commit6061d949dd984c762ee272a88e77699fa675d1c8 (patch)
tree2e19eecd34a716fc5ed9fa3f18a7db0a3edf6f5b /scripts
parentprio_tree: introduce prio_set_parent() (diff)
downloadlinux-6061d949dd984c762ee272a88e77699fa675d1c8.tar.xz
linux-6061d949dd984c762ee272a88e77699fa675d1c8.zip
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')
-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",