include/ and checkpatch: prefer __scanf to __attribute__((format(scanf,...)
[cascardo/linux.git] / scripts / checkpatch.pl
index a3b9782..89d24b3 100755 (executable)
@@ -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",