]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
scripts/checkpatch.pl: add WARN on sizeof(&foo)
authorJoe Perches <joe@perches.com>
Fri, 5 Mar 2010 21:43:48 +0000 (13:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Mar 2010 19:26:44 +0000 (11:26 -0800)
sizeof(&foo) is frequently an error.  Warn on its use.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 3257d3d96767da60103c3e7d91beef537541f3cc..309050f30874cf2361e06bb5386e45eb168e124c 100755 (executable)
@@ -2572,6 +2572,11 @@ sub process {
                        WARN("plain inline is preferred over $1\n" . $herecurr);
                }
 
+# check for sizeof(&)
+               if ($line =~ /\bsizeof\s*\(\s*\&/) {
+                       WARN("sizeof(& should be avoided\n" . $herecurr);
+               }
+
 # check for new externs in .c files.
                if ($realfile =~ /\.c$/ && defined $stat &&
                    $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)