diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 2 | ||||
-rw-r--r-- | scripts/Makefile.build | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 24 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 183 | ||||
-rw-r--r-- | scripts/coccinelle/api/ptr_ret.cocci | 70 | ||||
-rw-r--r-- | scripts/coccinelle/free/clk_put.cocci | 67 | ||||
-rw-r--r-- | scripts/coccinelle/free/iounmap.cocci | 67 | ||||
-rw-r--r-- | scripts/coccinelle/misc/boolinit.cocci | 178 | ||||
-rw-r--r-- | scripts/coccinelle/misc/cstptr.cocci | 41 | ||||
-rw-r--r-- | scripts/coccinelle/null/badzero.cocci | 237 | ||||
-rw-r--r-- | scripts/dtc/dtc.c | 5 | ||||
-rw-r--r-- | scripts/dtc/flattree.c | 2 | ||||
-rw-r--r-- | scripts/gcc-goto.sh | 18 | ||||
-rwxr-xr-x | scripts/get_maintainer.pl | 11 | ||||
-rw-r--r-- | scripts/headers_check.pl | 38 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 26 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/kconfig/merge_config.sh | 15 | ||||
-rw-r--r-- | scripts/kconfig/symbol.c | 9 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 25 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 2 | ||||
-rw-r--r-- | scripts/package/builddeb | 20 | ||||
-rwxr-xr-x | scripts/patch-kernel | 4 | ||||
-rwxr-xr-x | scripts/setlocalversion | 3 | ||||
-rwxr-xr-x | scripts/tags.sh | 13 |
24 files changed, 990 insertions, 72 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d897278b1f97..6a3ee981931d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -104,7 +104,7 @@ as-option = $(call try-run,\ | |||
104 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 104 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
105 | 105 | ||
106 | as-instr = $(call try-run,\ | 106 | as-instr = $(call try-run,\ |
107 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 107 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
108 | 108 | ||
109 | # cc-option | 109 | # cc-option |
110 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 110 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d2b366c16b64..ff1720d28d0c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -69,6 +69,7 @@ warning-1 += -Wmissing-prototypes | |||
69 | warning-1 += -Wold-style-definition | 69 | warning-1 += -Wold-style-definition |
70 | warning-1 += $(call cc-option, -Wmissing-include-dirs) | 70 | warning-1 += $(call cc-option, -Wmissing-include-dirs) |
71 | warning-1 += $(call cc-option, -Wunused-but-set-variable) | 71 | warning-1 += $(call cc-option, -Wunused-but-set-variable) |
72 | warning-1 += $(call cc-disable-warning, missing-field-initializers) | ||
72 | 73 | ||
73 | warning-2 := -Waggregate-return | 74 | warning-2 := -Waggregate-return |
74 | warning-2 += -Wcast-align | 75 | warning-2 += -Wcast-align |
@@ -76,6 +77,7 @@ warning-2 += -Wdisabled-optimization | |||
76 | warning-2 += -Wnested-externs | 77 | warning-2 += -Wnested-externs |
77 | warning-2 += -Wshadow | 78 | warning-2 += -Wshadow |
78 | warning-2 += $(call cc-option, -Wlogical-op) | 79 | warning-2 += $(call cc-option, -Wlogical-op) |
80 | warning-2 += $(call cc-option, -Wmissing-field-initializers) | ||
79 | 81 | ||
80 | warning-3 := -Wbad-function-cast | 82 | warning-3 := -Wbad-function-cast |
81 | warning-3 += -Wcast-qual | 83 | warning-3 += -Wcast-qual |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 00c368c6e996..0be6f110cce7 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -304,6 +304,30 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \ | |||
304 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ | 304 | lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ |
305 | (rm -f $@ ; false) | 305 | (rm -f $@ ; false) |
306 | 306 | ||
307 | # U-Boot mkimage | ||
308 | # --------------------------------------------------------------------------- | ||
309 | |||
310 | MKIMAGE := $(srctree)/scripts/mkuboot.sh | ||
311 | |||
312 | # SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces | ||
313 | # the number of overrides in arch makefiles | ||
314 | UIMAGE_ARCH ?= $(SRCARCH) | ||
315 | UIMAGE_COMPRESSION ?= $(if $(2),$(2),none) | ||
316 | UIMAGE_OPTS-y ?= | ||
317 | UIMAGE_TYPE ?= kernel | ||
318 | UIMAGE_LOADADDR ?= arch_must_set_this | ||
319 | UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) | ||
320 | UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)' | ||
321 | UIMAGE_IN ?= $< | ||
322 | UIMAGE_OUT ?= $@ | ||
323 | |||
324 | quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT) | ||
325 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ | ||
326 | -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \ | ||
327 | -T $(UIMAGE_TYPE) \ | ||
328 | -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \ | ||
329 | -n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT) | ||
330 | |||
307 | # XZ | 331 | # XZ |
308 | # --------------------------------------------------------------------------- | 332 | # --------------------------------------------------------------------------- |
309 | # Use xzkern to compress the kernel image and xzmisc to compress other things. | 333 | # Use xzkern to compress the kernel image and xzmisc to compress other things. |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a3b9782441f9..de639eeeed50 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -323,17 +323,22 @@ sub build_types { | |||
323 | }x; | 323 | }x; |
324 | $Type = qr{ | 324 | $Type = qr{ |
325 | $NonptrType | 325 | $NonptrType |
326 | (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? | 326 | (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? |
327 | (?:\s+$Inline|\s+$Modifier)* | 327 | (?:\s+$Inline|\s+$Modifier)* |
328 | }x; | 328 | }x; |
329 | $Declare = qr{(?:$Storage\s+)?$Type}; | 329 | $Declare = qr{(?:$Storage\s+)?$Type}; |
330 | } | 330 | } |
331 | build_types(); | 331 | build_types(); |
332 | 332 | ||
333 | our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/; | ||
334 | 333 | ||
335 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | 334 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; |
336 | our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; | 335 | |
336 | # Using $balanced_parens, $LvalOrFunc, or $FuncArg | ||
337 | # requires at least perl version v5.10.0 | ||
338 | # Any use must be runtime checked with $^V | ||
339 | |||
340 | our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/; | ||
341 | our $LvalOrFunc = qr{($Lval)\s*($balanced_parens{0,1})\s*}; | ||
337 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; | 342 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; |
338 | 343 | ||
339 | sub deparenthesize { | 344 | sub deparenthesize { |
@@ -1330,6 +1335,36 @@ sub check_absolute_file { | |||
1330 | } | 1335 | } |
1331 | } | 1336 | } |
1332 | 1337 | ||
1338 | sub pos_last_openparen { | ||
1339 | my ($line) = @_; | ||
1340 | |||
1341 | my $pos = 0; | ||
1342 | |||
1343 | my $opens = $line =~ tr/\(/\(/; | ||
1344 | my $closes = $line =~ tr/\)/\)/; | ||
1345 | |||
1346 | my $last_openparen = 0; | ||
1347 | |||
1348 | if (($opens == 0) || ($closes >= $opens)) { | ||
1349 | return -1; | ||
1350 | } | ||
1351 | |||
1352 | my $len = length($line); | ||
1353 | |||
1354 | for ($pos = 0; $pos < $len; $pos++) { | ||
1355 | my $string = substr($line, $pos); | ||
1356 | if ($string =~ /^($FuncArg|$balanced_parens)/) { | ||
1357 | $pos += length($1) - 1; | ||
1358 | } elsif (substr($line, $pos, 1) eq '(') { | ||
1359 | $last_openparen = $pos; | ||
1360 | } elsif (index($string, '(') == -1) { | ||
1361 | last; | ||
1362 | } | ||
1363 | } | ||
1364 | |||
1365 | return $last_openparen + 1; | ||
1366 | } | ||
1367 | |||
1333 | sub process { | 1368 | sub process { |
1334 | my $filename = shift; | 1369 | my $filename = shift; |
1335 | 1370 | ||
@@ -1737,6 +1772,21 @@ sub process { | |||
1737 | "line over 80 characters\n" . $herecurr); | 1772 | "line over 80 characters\n" . $herecurr); |
1738 | } | 1773 | } |
1739 | 1774 | ||
1775 | # Check for user-visible strings broken across lines, which breaks the ability | ||
1776 | # to grep for the string. Limited to strings used as parameters (those | ||
1777 | # following an open parenthesis), which almost completely eliminates false | ||
1778 | # positives, as well as warning only once per parameter rather than once per | ||
1779 | # line of the string. Make an exception when the previous string ends in a | ||
1780 | # newline (multiple lines in one string constant) or \n\t (common in inline | ||
1781 | # assembly to indent the instruction on the following line). | ||
1782 | if ($line =~ /^\+\s*"/ && | ||
1783 | $prevline =~ /"\s*$/ && | ||
1784 | $prevline =~ /\(/ && | ||
1785 | $prevrawline !~ /\\n(?:\\t)*"\s*$/) { | ||
1786 | WARN("SPLIT_STRING", | ||
1787 | "quoted string split across lines\n" . $hereprev); | ||
1788 | } | ||
1789 | |||
1740 | # check for spaces before a quoted newline | 1790 | # check for spaces before a quoted newline |
1741 | if ($rawline =~ /^.*\".*\s\\n/) { | 1791 | if ($rawline =~ /^.*\".*\s\\n/) { |
1742 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | 1792 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |
@@ -1783,6 +1833,48 @@ sub process { | |||
1783 | "please, no space before tabs\n" . $herevet); | 1833 | "please, no space before tabs\n" . $herevet); |
1784 | } | 1834 | } |
1785 | 1835 | ||
1836 | # check for && or || at the start of a line | ||
1837 | if ($rawline =~ /^\+\s*(&&|\|\|)/) { | ||
1838 | CHK("LOGICAL_CONTINUATIONS", | ||
1839 | "Logical continuations should be on the previous line\n" . $hereprev); | ||
1840 | } | ||
1841 | |||
1842 | # check multi-line statement indentation matches previous line | ||
1843 | if ($^V && $^V ge 5.10.0 && | ||
1844 | $prevline =~ /^\+(\t*)(if \(|$Ident\().*(\&\&|\|\||,)\s*$/) { | ||
1845 | $prevline =~ /^\+(\t*)(.*)$/; | ||
1846 | my $oldindent = $1; | ||
1847 | my $rest = $2; | ||
1848 | |||
1849 | my $pos = pos_last_openparen($rest); | ||
1850 | if ($pos >= 0) { | ||
1851 | $line =~ /^\+([ \t]*)/; | ||
1852 | my $newindent = $1; | ||
1853 | |||
1854 | my $goodtabindent = $oldindent . | ||
1855 | "\t" x ($pos / 8) . | ||
1856 | " " x ($pos % 8); | ||
1857 | my $goodspaceindent = $oldindent . " " x $pos; | ||
1858 | |||
1859 | if ($newindent ne $goodtabindent && | ||
1860 | $newindent ne $goodspaceindent) { | ||
1861 | CHK("PARENTHESIS_ALIGNMENT", | ||
1862 | "Alignment should match open parenthesis\n" . $hereprev); | ||
1863 | } | ||
1864 | } | ||
1865 | } | ||
1866 | |||
1867 | if ($line =~ /^\+.*\*[ \t]*\)[ \t]+/) { | ||
1868 | CHK("SPACING", | ||
1869 | "No space is necessary after a cast\n" . $hereprev); | ||
1870 | } | ||
1871 | |||
1872 | if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ && | ||
1873 | $prevrawline =~ /^\+[ \t]*$/) { | ||
1874 | CHK("BLOCK_COMMENT_STYLE", | ||
1875 | "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev); | ||
1876 | } | ||
1877 | |||
1786 | # check for spaces at the beginning of a line. | 1878 | # check for spaces at the beginning of a line. |
1787 | # Exceptions: | 1879 | # Exceptions: |
1788 | # 1) within comments | 1880 | # 1) within comments |
@@ -2325,7 +2417,7 @@ sub process { | |||
2325 | my ($where, $prefix) = ($-[1], $1); | 2417 | my ($where, $prefix) = ($-[1], $1); |
2326 | if ($prefix !~ /$Type\s+$/ && | 2418 | if ($prefix !~ /$Type\s+$/ && |
2327 | ($where != 0 || $prefix !~ /^.\s+$/) && | 2419 | ($where != 0 || $prefix !~ /^.\s+$/) && |
2328 | $prefix !~ /{\s+$/) { | 2420 | $prefix !~ /[{,]\s+$/) { |
2329 | ERROR("BRACKET_SPACE", | 2421 | ERROR("BRACKET_SPACE", |
2330 | "space prohibited before open square bracket '['\n" . $herecurr); | 2422 | "space prohibited before open square bracket '['\n" . $herecurr); |
2331 | } | 2423 | } |
@@ -2828,6 +2920,12 @@ sub process { | |||
2828 | { | 2920 | { |
2829 | } | 2921 | } |
2830 | 2922 | ||
2923 | # Flatten any obvious string concatentation. | ||
2924 | while ($dstat =~ s/("X*")\s*$Ident/$1/ || | ||
2925 | $dstat =~ s/$Ident\s*("X*")/$1/) | ||
2926 | { | ||
2927 | } | ||
2928 | |||
2831 | my $exceptions = qr{ | 2929 | my $exceptions = qr{ |
2832 | $Declare| | 2930 | $Declare| |
2833 | module_param_named| | 2931 | module_param_named| |
@@ -2844,7 +2942,8 @@ sub process { | |||
2844 | if ($dstat ne '' && | 2942 | if ($dstat ne '' && |
2845 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), | 2943 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), |
2846 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); | 2944 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); |
2847 | $dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo() | 2945 | $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo |
2946 | $dstat !~ /^'X'$/ && # character constants | ||
2848 | $dstat !~ /$exceptions/ && | 2947 | $dstat !~ /$exceptions/ && |
2849 | $dstat !~ /^\.$Ident\s*=/ && # .foo = | 2948 | $dstat !~ /^\.$Ident\s*=/ && # .foo = |
2850 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) | 2949 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) |
@@ -2888,7 +2987,8 @@ sub process { | |||
2888 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; | 2987 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; |
2889 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; | 2988 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; |
2890 | if ($#chunks > 0 && $level == 0) { | 2989 | if ($#chunks > 0 && $level == 0) { |
2891 | my $allowed = 0; | 2990 | my @allowed = (); |
2991 | my $allow = 0; | ||
2892 | my $seen = 0; | 2992 | my $seen = 0; |
2893 | my $herectx = $here . "\n"; | 2993 | my $herectx = $here . "\n"; |
2894 | my $ln = $linenr - 1; | 2994 | my $ln = $linenr - 1; |
@@ -2899,6 +2999,7 @@ sub process { | |||
2899 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); | 2999 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); |
2900 | my $offset = statement_rawlines($whitespace) - 1; | 3000 | my $offset = statement_rawlines($whitespace) - 1; |
2901 | 3001 | ||
3002 | $allowed[$allow] = 0; | ||
2902 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; | 3003 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; |
2903 | 3004 | ||
2904 | # We have looked at and allowed this specific line. | 3005 | # We have looked at and allowed this specific line. |
@@ -2911,23 +3012,34 @@ sub process { | |||
2911 | 3012 | ||
2912 | $seen++ if ($block =~ /^\s*{/); | 3013 | $seen++ if ($block =~ /^\s*{/); |
2913 | 3014 | ||
2914 | #print "cond<$cond> block<$block> allowed<$allowed>\n"; | 3015 | #print "cond<$cond> block<$block> allowed<$allowed[$allow]>\n"; |
2915 | if (statement_lines($cond) > 1) { | 3016 | if (statement_lines($cond) > 1) { |
2916 | #print "APW: ALLOWED: cond<$cond>\n"; | 3017 | #print "APW: ALLOWED: cond<$cond>\n"; |
2917 | $allowed = 1; | 3018 | $allowed[$allow] = 1; |
2918 | } | 3019 | } |
2919 | if ($block =~/\b(?:if|for|while)\b/) { | 3020 | if ($block =~/\b(?:if|for|while)\b/) { |
2920 | #print "APW: ALLOWED: block<$block>\n"; | 3021 | #print "APW: ALLOWED: block<$block>\n"; |
2921 | $allowed = 1; | 3022 | $allowed[$allow] = 1; |
2922 | } | 3023 | } |
2923 | if (statement_block_size($block) > 1) { | 3024 | if (statement_block_size($block) > 1) { |
2924 | #print "APW: ALLOWED: lines block<$block>\n"; | 3025 | #print "APW: ALLOWED: lines block<$block>\n"; |
2925 | $allowed = 1; | 3026 | $allowed[$allow] = 1; |
2926 | } | 3027 | } |
3028 | $allow++; | ||
2927 | } | 3029 | } |
2928 | if ($seen && !$allowed) { | 3030 | if ($seen) { |
2929 | WARN("BRACES", | 3031 | my $sum_allowed = 0; |
2930 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | 3032 | foreach (@allowed) { |
3033 | $sum_allowed += $_; | ||
3034 | } | ||
3035 | if ($sum_allowed == 0) { | ||
3036 | WARN("BRACES", | ||
3037 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | ||
3038 | } elsif ($sum_allowed != $allow && | ||
3039 | $seen != $allow) { | ||
3040 | CHK("BRACES", | ||
3041 | "braces {} should be used on all arms of this statement\n" . $herectx); | ||
3042 | } | ||
2931 | } | 3043 | } |
2932 | } | 3044 | } |
2933 | } | 3045 | } |
@@ -3123,6 +3235,12 @@ sub process { | |||
3123 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); | 3235 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); |
3124 | } | 3236 | } |
3125 | 3237 | ||
3238 | # Check for __attribute__ format(scanf, prefer __scanf | ||
3239 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { | ||
3240 | WARN("PREFER_SCANF", | ||
3241 | "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr); | ||
3242 | } | ||
3243 | |||
3126 | # check for sizeof(&) | 3244 | # check for sizeof(&) |
3127 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 3245 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
3128 | WARN("SIZEOF_ADDRESS", | 3246 | WARN("SIZEOF_ADDRESS", |
@@ -3136,12 +3254,13 @@ sub process { | |||
3136 | } | 3254 | } |
3137 | 3255 | ||
3138 | # Check for misused memsets | 3256 | # Check for misused memsets |
3139 | if (defined $stat && | 3257 | if ($^V && $^V ge 5.10.0 && |
3258 | defined $stat && | ||
3140 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { | 3259 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { |
3141 | 3260 | ||
3142 | my $ms_addr = $2; | 3261 | my $ms_addr = $2; |
3143 | my $ms_val = $8; | 3262 | my $ms_val = $7; |
3144 | my $ms_size = $14; | 3263 | my $ms_size = $12; |
3145 | 3264 | ||
3146 | if ($ms_size =~ /^(0x|)0$/i) { | 3265 | if ($ms_size =~ /^(0x|)0$/i) { |
3147 | ERROR("MEMSET", | 3266 | ERROR("MEMSET", |
@@ -3153,17 +3272,18 @@ sub process { | |||
3153 | } | 3272 | } |
3154 | 3273 | ||
3155 | # typecasts on min/max could be min_t/max_t | 3274 | # typecasts on min/max could be min_t/max_t |
3156 | if (defined $stat && | 3275 | if ($^V && $^V ge 5.10.0 && |
3276 | defined $stat && | ||
3157 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { | 3277 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { |
3158 | if (defined $2 || defined $8) { | 3278 | if (defined $2 || defined $7) { |
3159 | my $call = $1; | 3279 | my $call = $1; |
3160 | my $cast1 = deparenthesize($2); | 3280 | my $cast1 = deparenthesize($2); |
3161 | my $arg1 = $3; | 3281 | my $arg1 = $3; |
3162 | my $cast2 = deparenthesize($8); | 3282 | my $cast2 = deparenthesize($7); |
3163 | my $arg2 = $9; | 3283 | my $arg2 = $8; |
3164 | my $cast; | 3284 | my $cast; |
3165 | 3285 | ||
3166 | if ($cast1 ne "" && $cast2 ne "") { | 3286 | if ($cast1 ne "" && $cast2 ne "" && $cast1 ne $cast2) { |
3167 | $cast = "$cast1 or $cast2"; | 3287 | $cast = "$cast1 or $cast2"; |
3168 | } elsif ($cast1 ne "") { | 3288 | } elsif ($cast1 ne "") { |
3169 | $cast = $cast1; | 3289 | $cast = $cast1; |
@@ -3233,22 +3353,30 @@ sub process { | |||
3233 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); | 3353 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); |
3234 | } | 3354 | } |
3235 | 3355 | ||
3356 | # check for use of yield() | ||
3357 | if ($line =~ /\byield\s*\(\s*\)/) { | ||
3358 | WARN("YIELD", | ||
3359 | "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr); | ||
3360 | } | ||
3361 | |||
3236 | # check for semaphores initialized locked | 3362 | # check for semaphores initialized locked |
3237 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 3363 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
3238 | WARN("CONSIDER_COMPLETION", | 3364 | WARN("CONSIDER_COMPLETION", |
3239 | "consider using a completion\n" . $herecurr); | 3365 | "consider using a completion\n" . $herecurr); |
3240 | |||
3241 | } | 3366 | } |
3367 | |||
3242 | # recommend kstrto* over simple_strto* and strict_strto* | 3368 | # recommend kstrto* over simple_strto* and strict_strto* |
3243 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { | 3369 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { |
3244 | WARN("CONSIDER_KSTRTO", | 3370 | WARN("CONSIDER_KSTRTO", |
3245 | "$1 is obsolete, use k$3 instead\n" . $herecurr); | 3371 | "$1 is obsolete, use k$3 instead\n" . $herecurr); |
3246 | } | 3372 | } |
3373 | |||
3247 | # check for __initcall(), use device_initcall() explicitly please | 3374 | # check for __initcall(), use device_initcall() explicitly please |
3248 | if ($line =~ /^.\s*__initcall\s*\(/) { | 3375 | if ($line =~ /^.\s*__initcall\s*\(/) { |
3249 | WARN("USE_DEVICE_INITCALL", | 3376 | WARN("USE_DEVICE_INITCALL", |
3250 | "please use device_initcall() instead of __initcall()\n" . $herecurr); | 3377 | "please use device_initcall() instead of __initcall()\n" . $herecurr); |
3251 | } | 3378 | } |
3379 | |||
3252 | # check for various ops structs, ensure they are const. | 3380 | # check for various ops structs, ensure they are const. |
3253 | my $struct_ops = qr{acpi_dock_ops| | 3381 | my $struct_ops = qr{acpi_dock_ops| |
3254 | address_space_operations| | 3382 | address_space_operations| |
@@ -3385,6 +3513,12 @@ sub process { | |||
3385 | } | 3513 | } |
3386 | 3514 | ||
3387 | if ($quiet == 0) { | 3515 | if ($quiet == 0) { |
3516 | |||
3517 | if ($^V lt 5.10.0) { | ||
3518 | print("NOTE: perl $^V is not modern enough to detect all possible issues.\n"); | ||
3519 | print("An upgrade to at least perl v5.10.0 is suggested.\n\n"); | ||
3520 | } | ||
3521 | |||
3388 | # If there were whitespace errors which cleanpatch can fix | 3522 | # If there were whitespace errors which cleanpatch can fix |
3389 | # then suggest that. | 3523 | # then suggest that. |
3390 | if ($rpt_cleaners) { | 3524 | if ($rpt_cleaners) { |
@@ -3394,13 +3528,12 @@ sub process { | |||
3394 | } | 3528 | } |
3395 | } | 3529 | } |
3396 | 3530 | ||
3397 | if (keys %ignore_type) { | 3531 | if ($quiet == 0 && keys %ignore_type) { |
3398 | print "NOTE: Ignored message types:"; | 3532 | print "NOTE: Ignored message types:"; |
3399 | foreach my $ignore (sort keys %ignore_type) { | 3533 | foreach my $ignore (sort keys %ignore_type) { |
3400 | print " $ignore"; | 3534 | print " $ignore"; |
3401 | } | 3535 | } |
3402 | print "\n"; | 3536 | print "\n\n"; |
3403 | print "\n" if ($quiet == 0); | ||
3404 | } | 3537 | } |
3405 | 3538 | ||
3406 | if ($clean == 1 && $quiet == 0) { | 3539 | if ($clean == 1 && $quiet == 0) { |
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci new file mode 100644 index 000000000000..cbfd08c7d8c7 --- /dev/null +++ b/scripts/coccinelle/api/ptr_ret.cocci | |||
@@ -0,0 +1,70 @@ | |||
1 | /// | ||
2 | /// Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
7 | // URL: http://coccinelle.lip6.fr/ | ||
8 | // Options: -no_includes -include_headers | ||
9 | // | ||
10 | // Keywords: ERR_PTR, PTR_ERR, PTR_RET | ||
11 | // Version min: 2.6.39 | ||
12 | // | ||
13 | |||
14 | virtual context | ||
15 | virtual patch | ||
16 | virtual org | ||
17 | virtual report | ||
18 | |||
19 | @depends on patch@ | ||
20 | expression ptr; | ||
21 | @@ | ||
22 | |||
23 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; | ||
24 | + return PTR_RET(ptr); | ||
25 | |||
26 | @depends on patch@ | ||
27 | expression ptr; | ||
28 | @@ | ||
29 | |||
30 | - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | ||
31 | + return PTR_RET(ptr); | ||
32 | |||
33 | @r1 depends on !patch@ | ||
34 | expression ptr; | ||
35 | position p1; | ||
36 | @@ | ||
37 | |||
38 | * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; | ||
39 | |||
40 | @r2 depends on !patch@ | ||
41 | expression ptr; | ||
42 | position p2; | ||
43 | @@ | ||
44 | |||
45 | * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; | ||
46 | |||
47 | @script:python depends on org@ | ||
48 | p << r1.p1; | ||
49 | @@ | ||
50 | |||
51 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
52 | |||
53 | |||
54 | @script:python depends on org@ | ||
55 | p << r2.p2; | ||
56 | @@ | ||
57 | |||
58 | coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") | ||
59 | |||
60 | @script:python depends on report@ | ||
61 | p << r1.p1; | ||
62 | @@ | ||
63 | |||
64 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
65 | |||
66 | @script:python depends on report@ | ||
67 | p << r2.p2; | ||
68 | @@ | ||
69 | |||
70 | coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") | ||
diff --git a/scripts/coccinelle/free/clk_put.cocci b/scripts/coccinelle/free/clk_put.cocci new file mode 100644 index 000000000000..46747adfd20a --- /dev/null +++ b/scripts/coccinelle/free/clk_put.cocci | |||
@@ -0,0 +1,67 @@ | |||
1 | /// Find missing clk_puts. | ||
2 | /// | ||
3 | //# This only signals a missing clk_put when there is a clk_put later | ||
4 | //# in the same function. | ||
5 | //# False positives can be due to loops. | ||
6 | // | ||
7 | // Confidence: Moderate | ||
8 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
10 | // URL: http://coccinelle.lip6.fr/ | ||
11 | // Comments: | ||
12 | // Options: | ||
13 | |||
14 | virtual context | ||
15 | virtual org | ||
16 | virtual report | ||
17 | |||
18 | @clk@ | ||
19 | expression e; | ||
20 | statement S,S1; | ||
21 | int ret; | ||
22 | position p1,p2,p3; | ||
23 | @@ | ||
24 | |||
25 | e = clk_get@p1(...) | ||
26 | ... when != clk_put(e) | ||
27 | if (<+...e...+>) S | ||
28 | ... when any | ||
29 | when != clk_put(e) | ||
30 | when != if (...) { ... clk_put(e); ... } | ||
31 | ( | ||
32 | if (ret == 0) S1 | ||
33 | | | ||
34 | if (...) | ||
35 | { ... | ||
36 | return 0; } | ||
37 | | | ||
38 | if (...) | ||
39 | { ... | ||
40 | return <+...e...+>; } | ||
41 | | | ||
42 | *if@p2 (...) | ||
43 | { ... when != clk_put(e) | ||
44 | when forall | ||
45 | return@p3 ...; } | ||
46 | ) | ||
47 | ... when any | ||
48 | clk_put(e); | ||
49 | |||
50 | @script:python depends on org@ | ||
51 | p1 << clk.p1; | ||
52 | p2 << clk.p2; | ||
53 | p3 << clk.p3; | ||
54 | @@ | ||
55 | |||
56 | cocci.print_main("clk_get",p1) | ||
57 | cocci.print_secs("if",p2) | ||
58 | cocci.print_secs("needed clk_put",p3) | ||
59 | |||
60 | @script:python depends on report@ | ||
61 | p1 << clk.p1; | ||
62 | p2 << clk.p2; | ||
63 | p3 << clk.p3; | ||
64 | @@ | ||
65 | |||
66 | msg = "ERROR: missing clk_put; clk_get on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
67 | coccilib.report.print_report(p3[0],msg) | ||
diff --git a/scripts/coccinelle/free/iounmap.cocci b/scripts/coccinelle/free/iounmap.cocci new file mode 100644 index 000000000000..5384f4ba1192 --- /dev/null +++ b/scripts/coccinelle/free/iounmap.cocci | |||
@@ -0,0 +1,67 @@ | |||
1 | /// Find missing iounmaps. | ||
2 | /// | ||
3 | //# This only signals a missing iounmap when there is an iounmap later | ||
4 | //# in the same function. | ||
5 | //# False positives can be due to loops. | ||
6 | // | ||
7 | // Confidence: Moderate | ||
8 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
9 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
10 | // URL: http://coccinelle.lip6.fr/ | ||
11 | // Comments: | ||
12 | // Options: | ||
13 | |||
14 | virtual context | ||
15 | virtual org | ||
16 | virtual report | ||
17 | |||
18 | @iom@ | ||
19 | expression e; | ||
20 | statement S,S1; | ||
21 | int ret; | ||
22 | position p1,p2,p3; | ||
23 | @@ | ||
24 | |||
25 | e = \(ioremap@p1\|ioremap_nocache@p1\)(...) | ||
26 | ... when != iounmap(e) | ||
27 | if (<+...e...+>) S | ||
28 | ... when any | ||
29 | when != iounmap(e) | ||
30 | when != if (...) { ... iounmap(e); ... } | ||
31 | ( | ||
32 | if (ret == 0) S1 | ||
33 | | | ||
34 | if (...) | ||
35 | { ... | ||
36 | return 0; } | ||
37 | | | ||
38 | if (...) | ||
39 | { ... | ||
40 | return <+...e...+>; } | ||
41 | | | ||
42 | *if@p2 (...) | ||
43 | { ... when != iounmap(e) | ||
44 | when forall | ||
45 | return@p3 ...; } | ||
46 | ) | ||
47 | ... when any | ||
48 | iounmap(e); | ||
49 | |||
50 | @script:python depends on org@ | ||
51 | p1 << iom.p1; | ||
52 | p2 << iom.p2; | ||
53 | p3 << iom.p3; | ||
54 | @@ | ||
55 | |||
56 | cocci.print_main("ioremap",p1) | ||
57 | cocci.print_secs("if",p2) | ||
58 | cocci.print_secs("needed iounmap",p3) | ||
59 | |||
60 | @script:python depends on report@ | ||
61 | p1 << iom.p1; | ||
62 | p2 << iom.p2; | ||
63 | p3 << iom.p3; | ||
64 | @@ | ||
65 | |||
66 | msg = "ERROR: missing iounmap; ioremap on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) | ||
67 | coccilib.report.print_report(p3[0],msg) | ||
diff --git a/scripts/coccinelle/misc/boolinit.cocci b/scripts/coccinelle/misc/boolinit.cocci new file mode 100644 index 000000000000..97ce41ce8135 --- /dev/null +++ b/scripts/coccinelle/misc/boolinit.cocci | |||
@@ -0,0 +1,178 @@ | |||
1 | /// Bool initializations should use true and false. Bool tests don't need | ||
2 | /// comparisons. Based on contributions from Joe Perches, Rusty Russell | ||
3 | /// and Bruce W Allan. | ||
4 | /// | ||
5 | // Confidence: High | ||
6 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
7 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
8 | // URL: http://coccinelle.lip6.fr/ | ||
9 | // Options: -include_headers | ||
10 | |||
11 | virtual patch | ||
12 | virtual context | ||
13 | virtual org | ||
14 | virtual report | ||
15 | |||
16 | @depends on patch@ | ||
17 | bool t; | ||
18 | symbol true; | ||
19 | symbol false; | ||
20 | @@ | ||
21 | |||
22 | ( | ||
23 | - t == true | ||
24 | + t | ||
25 | | | ||
26 | - true == t | ||
27 | + t | ||
28 | | | ||
29 | - t != true | ||
30 | + !t | ||
31 | | | ||
32 | - true != t | ||
33 | + !t | ||
34 | | | ||
35 | - t == false | ||
36 | + !t | ||
37 | | | ||
38 | - false == t | ||
39 | + !t | ||
40 | | | ||
41 | - t != false | ||
42 | + t | ||
43 | | | ||
44 | - false != t | ||
45 | + t | ||
46 | ) | ||
47 | |||
48 | @depends on patch disable is_zero, isnt_zero@ | ||
49 | bool t; | ||
50 | @@ | ||
51 | |||
52 | ( | ||
53 | - t == 1 | ||
54 | + t | ||
55 | | | ||
56 | - t != 1 | ||
57 | + !t | ||
58 | | | ||
59 | - t == 0 | ||
60 | + !t | ||
61 | | | ||
62 | - t != 0 | ||
63 | + t | ||
64 | ) | ||
65 | |||
66 | @depends on patch@ | ||
67 | bool b; | ||
68 | @@ | ||
69 | ( | ||
70 | b = | ||
71 | - 0 | ||
72 | + false | ||
73 | | | ||
74 | b = | ||
75 | - 1 | ||
76 | + true | ||
77 | ) | ||
78 | |||
79 | // --------------------------------------------------------------------- | ||
80 | |||
81 | @r1 depends on !patch@ | ||
82 | bool t; | ||
83 | position p; | ||
84 | @@ | ||
85 | |||
86 | ( | ||
87 | * t@p == true | ||
88 | | | ||
89 | * true == t@p | ||
90 | | | ||
91 | * t@p != true | ||
92 | | | ||
93 | * true != t@p | ||
94 | | | ||
95 | * t@p == false | ||
96 | | | ||
97 | * false == t@p | ||
98 | | | ||
99 | * t@p != false | ||
100 | | | ||
101 | * false != t@p | ||
102 | ) | ||
103 | |||
104 | @r2 depends on !patch disable is_zero, isnt_zero@ | ||
105 | bool t; | ||
106 | position p; | ||
107 | @@ | ||
108 | |||
109 | ( | ||
110 | * t@p == 1 | ||
111 | | | ||
112 | * t@p != 1 | ||
113 | | | ||
114 | * t@p == 0 | ||
115 | | | ||
116 | * t@p != 0 | ||
117 | ) | ||
118 | |||
119 | @r3 depends on !patch@ | ||
120 | bool b; | ||
121 | position p1,p2; | ||
122 | constant c; | ||
123 | @@ | ||
124 | ( | ||
125 | *b@p1 = 0 | ||
126 | | | ||
127 | *b@p1 = 1 | ||
128 | | | ||
129 | *b@p2 = c | ||
130 | ) | ||
131 | |||
132 | @script:python depends on org@ | ||
133 | p << r1.p; | ||
134 | @@ | ||
135 | |||
136 | cocci.print_main("WARNING: Comparison to bool",p) | ||
137 | |||
138 | @script:python depends on org@ | ||
139 | p << r2.p; | ||
140 | @@ | ||
141 | |||
142 | cocci.print_main("WARNING: Comparison of bool to 0/1",p) | ||
143 | |||
144 | @script:python depends on org@ | ||
145 | p1 << r3.p1; | ||
146 | @@ | ||
147 | |||
148 | cocci.print_main("WARNING: Assignment of bool to 0/1",p1) | ||
149 | |||
150 | @script:python depends on org@ | ||
151 | p2 << r3.p2; | ||
152 | @@ | ||
153 | |||
154 | cocci.print_main("ERROR: Assignment of bool to non-0/1 constant",p2) | ||
155 | |||
156 | @script:python depends on report@ | ||
157 | p << r1.p; | ||
158 | @@ | ||
159 | |||
160 | coccilib.report.print_report(p[0],"WARNING: Comparison to bool") | ||
161 | |||
162 | @script:python depends on report@ | ||
163 | p << r2.p; | ||
164 | @@ | ||
165 | |||
166 | coccilib.report.print_report(p[0],"WARNING: Comparison of bool to 0/1") | ||
167 | |||
168 | @script:python depends on report@ | ||
169 | p1 << r3.p1; | ||
170 | @@ | ||
171 | |||
172 | coccilib.report.print_report(p1[0],"WARNING: Assignment of bool to 0/1") | ||
173 | |||
174 | @script:python depends on report@ | ||
175 | p2 << r3.p2; | ||
176 | @@ | ||
177 | |||
178 | coccilib.report.print_report(p2[0],"ERROR: Assignment of bool to non-0/1 constant") | ||
diff --git a/scripts/coccinelle/misc/cstptr.cocci b/scripts/coccinelle/misc/cstptr.cocci new file mode 100644 index 000000000000..d42564484528 --- /dev/null +++ b/scripts/coccinelle/misc/cstptr.cocci | |||
@@ -0,0 +1,41 @@ | |||
1 | /// PTR_ERR should be applied before its argument is reassigned, typically | ||
2 | /// to NULL | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
7 | // URL: http://coccinelle.lip6.fr/ | ||
8 | // Comments: | ||
9 | // Options: -no_includes -include_headers | ||
10 | |||
11 | virtual org | ||
12 | virtual report | ||
13 | virtual context | ||
14 | |||
15 | @r exists@ | ||
16 | expression e,e1; | ||
17 | constant c; | ||
18 | position p1,p2; | ||
19 | @@ | ||
20 | |||
21 | *e@p1 = c | ||
22 | ... when != e = e1 | ||
23 | when != &e | ||
24 | when != true IS_ERR(e) | ||
25 | *PTR_ERR@p2(e) | ||
26 | |||
27 | @script:python depends on org@ | ||
28 | p1 << r.p1; | ||
29 | p2 << r.p2; | ||
30 | @@ | ||
31 | |||
32 | cocci.print_main("PTR_ERR",p2) | ||
33 | cocci.print_secs("assignment",p1) | ||
34 | |||
35 | @script:python depends on report@ | ||
36 | p1 << r.p1; | ||
37 | p2 << r.p2; | ||
38 | @@ | ||
39 | |||
40 | msg = "ERROR: PTR_ERR applied after initialization to constant on line %s" % (p1[0].line) | ||
41 | coccilib.report.print_report(p2[0],msg) | ||
diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci new file mode 100644 index 000000000000..d79baf7220e7 --- /dev/null +++ b/scripts/coccinelle/null/badzero.cocci | |||
@@ -0,0 +1,237 @@ | |||
1 | /// Compare pointer-typed values to NULL rather than 0 | ||
2 | /// | ||
3 | //# This makes an effort to choose between !x and x == NULL. !x is used | ||
4 | //# if it has previously been used with the function used to initialize x. | ||
5 | //# This relies on type information. More type information can be obtained | ||
6 | //# using the option -all_includes and the option -I to specify an | ||
7 | //# include path. | ||
8 | // | ||
9 | // Confidence: High | ||
10 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
12 | // URL: http://coccinelle.lip6.fr/ | ||
13 | // Comments: | ||
14 | // Options: | ||
15 | |||
16 | virtual patch | ||
17 | virtual context | ||
18 | virtual org | ||
19 | virtual report | ||
20 | |||
21 | @initialize:ocaml@ | ||
22 | let negtable = Hashtbl.create 101 | ||
23 | |||
24 | @depends on patch@ | ||
25 | expression *E; | ||
26 | identifier f; | ||
27 | @@ | ||
28 | |||
29 | ( | ||
30 | (E = f(...)) == | ||
31 | - 0 | ||
32 | + NULL | ||
33 | | | ||
34 | (E = f(...)) != | ||
35 | - 0 | ||
36 | + NULL | ||
37 | | | ||
38 | - 0 | ||
39 | + NULL | ||
40 | == (E = f(...)) | ||
41 | | | ||
42 | - 0 | ||
43 | + NULL | ||
44 | != (E = f(...)) | ||
45 | ) | ||
46 | |||
47 | |||
48 | @t1 depends on !patch@ | ||
49 | expression *E; | ||
50 | identifier f; | ||
51 | position p; | ||
52 | @@ | ||
53 | |||
54 | ( | ||
55 | (E = f(...)) == | ||
56 | * 0@p | ||
57 | | | ||
58 | (E = f(...)) != | ||
59 | * 0@p | ||
60 | | | ||
61 | * 0@p | ||
62 | == (E = f(...)) | ||
63 | | | ||
64 | * 0@p | ||
65 | != (E = f(...)) | ||
66 | ) | ||
67 | |||
68 | @script:python depends on org@ | ||
69 | p << t1.p; | ||
70 | @@ | ||
71 | |||
72 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
73 | |||
74 | @script:python depends on report@ | ||
75 | p << t1.p; | ||
76 | @@ | ||
77 | |||
78 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
79 | |||
80 | // Tests of returned values | ||
81 | |||
82 | @s@ | ||
83 | identifier f; | ||
84 | expression E,E1; | ||
85 | @@ | ||
86 | |||
87 | E = f(...) | ||
88 | ... when != E = E1 | ||
89 | !E | ||
90 | |||
91 | @script:ocaml depends on s@ | ||
92 | f << s.f; | ||
93 | @@ | ||
94 | |||
95 | try let _ = Hashtbl.find negtable f in () | ||
96 | with Not_found -> Hashtbl.add negtable f () | ||
97 | |||
98 | @ r disable is_zero,isnt_zero exists @ | ||
99 | expression *E; | ||
100 | identifier f; | ||
101 | @@ | ||
102 | |||
103 | E = f(...) | ||
104 | ... | ||
105 | (E == 0 | ||
106 | |E != 0 | ||
107 | |0 == E | ||
108 | |0 != E | ||
109 | ) | ||
110 | |||
111 | @script:ocaml@ | ||
112 | f << r.f; | ||
113 | @@ | ||
114 | |||
115 | try let _ = Hashtbl.find negtable f in () | ||
116 | with Not_found -> include_match false | ||
117 | |||
118 | // This rule may lead to inconsistent path problems, if E is defined in two | ||
119 | // places | ||
120 | @ depends on patch disable is_zero,isnt_zero @ | ||
121 | expression *E; | ||
122 | expression E1; | ||
123 | identifier r.f; | ||
124 | @@ | ||
125 | |||
126 | E = f(...) | ||
127 | <... | ||
128 | ( | ||
129 | - E == 0 | ||
130 | + !E | ||
131 | | | ||
132 | - E != 0 | ||
133 | + E | ||
134 | | | ||
135 | - 0 == E | ||
136 | + !E | ||
137 | | | ||
138 | - 0 != E | ||
139 | + E | ||
140 | ) | ||
141 | ...> | ||
142 | ?E = E1 | ||
143 | |||
144 | @t2 depends on !patch disable is_zero,isnt_zero @ | ||
145 | expression *E; | ||
146 | expression E1; | ||
147 | identifier r.f; | ||
148 | position p1; | ||
149 | position p2; | ||
150 | @@ | ||
151 | |||
152 | E = f(...) | ||
153 | <... | ||
154 | ( | ||
155 | * E == 0@p1 | ||
156 | | | ||
157 | * E != 0@p2 | ||
158 | | | ||
159 | * 0@p1 == E | ||
160 | | | ||
161 | * 0@p1 != E | ||
162 | ) | ||
163 | ...> | ||
164 | ?E = E1 | ||
165 | |||
166 | @script:python depends on org@ | ||
167 | p << t2.p1; | ||
168 | @@ | ||
169 | |||
170 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
171 | |||
172 | @script:python depends on org@ | ||
173 | p << t2.p2; | ||
174 | @@ | ||
175 | |||
176 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
177 | |||
178 | @script:python depends on report@ | ||
179 | p << t2.p1; | ||
180 | @@ | ||
181 | |||
182 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0, suggest !E") | ||
183 | |||
184 | @script:python depends on report@ | ||
185 | p << t2.p2; | ||
186 | @@ | ||
187 | |||
188 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
189 | |||
190 | @ depends on patch disable is_zero,isnt_zero @ | ||
191 | expression *E; | ||
192 | @@ | ||
193 | |||
194 | ( | ||
195 | E == | ||
196 | - 0 | ||
197 | + NULL | ||
198 | | | ||
199 | E != | ||
200 | - 0 | ||
201 | + NULL | ||
202 | | | ||
203 | - 0 | ||
204 | + NULL | ||
205 | == E | ||
206 | | | ||
207 | - 0 | ||
208 | + NULL | ||
209 | != E | ||
210 | ) | ||
211 | |||
212 | @ t3 depends on !patch disable is_zero,isnt_zero @ | ||
213 | expression *E; | ||
214 | position p; | ||
215 | @@ | ||
216 | |||
217 | ( | ||
218 | * E == 0@p | ||
219 | | | ||
220 | * E != 0@p | ||
221 | | | ||
222 | * 0@p == E | ||
223 | | | ||
224 | * 0@p != E | ||
225 | ) | ||
226 | |||
227 | @script:python depends on org@ | ||
228 | p << t3.p; | ||
229 | @@ | ||
230 | |||
231 | coccilib.org.print_todo(p[0], "WARNING comparing pointer to 0") | ||
232 | |||
233 | @script:python depends on report@ | ||
234 | p << t3.p; | ||
235 | @@ | ||
236 | |||
237 | coccilib.report.print_report(p[0], "WARNING comparing pointer to 0") | ||
diff --git a/scripts/dtc/dtc.c b/scripts/dtc/dtc.c index 451c92d31b19..2ef5e2e3dd38 100644 --- a/scripts/dtc/dtc.c +++ b/scripts/dtc/dtc.c | |||
@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) | |||
101 | const char *outform = "dts"; | 101 | const char *outform = "dts"; |
102 | const char *outname = "-"; | 102 | const char *outname = "-"; |
103 | const char *depname = NULL; | 103 | const char *depname = NULL; |
104 | int force = 0, check = 0, sort = 0; | 104 | int force = 0, sort = 0; |
105 | const char *arg; | 105 | const char *arg; |
106 | int opt; | 106 | int opt; |
107 | FILE *outf = NULL; | 107 | FILE *outf = NULL; |
@@ -143,9 +143,6 @@ int main(int argc, char *argv[]) | |||
143 | case 'f': | 143 | case 'f': |
144 | force = 1; | 144 | force = 1; |
145 | break; | 145 | break; |
146 | case 'c': | ||
147 | check = 1; | ||
148 | break; | ||
149 | case 'q': | 146 | case 'q': |
150 | quiet++; | 147 | quiet++; |
151 | break; | 148 | break; |
diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index ead0332c87e1..28d0b2381df6 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c | |||
@@ -697,7 +697,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) | |||
697 | { | 697 | { |
698 | struct reserve_info *reservelist = NULL; | 698 | struct reserve_info *reservelist = NULL; |
699 | struct reserve_info *new; | 699 | struct reserve_info *new; |
700 | const char *p; | ||
701 | struct fdt_reserve_entry re; | 700 | struct fdt_reserve_entry re; |
702 | 701 | ||
703 | /* | 702 | /* |
@@ -706,7 +705,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb) | |||
706 | * | 705 | * |
707 | * First pass, count entries. | 706 | * First pass, count entries. |
708 | */ | 707 | */ |
709 | p = inb->ptr; | ||
710 | while (1) { | 708 | while (1) { |
711 | flat_read_chunk(inb, &re, sizeof(re)); | 709 | flat_read_chunk(inb, &re, sizeof(re)); |
712 | re.address = fdt64_to_cpu(re.address); | 710 | re.address = fdt64_to_cpu(re.address); |
diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh index 98cffcb941ea..a2af2e88daf3 100644 --- a/scripts/gcc-goto.sh +++ b/scripts/gcc-goto.sh | |||
@@ -2,4 +2,20 @@ | |||
2 | # Test for gcc 'asm goto' support | 2 | # Test for gcc 'asm goto' support |
3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> | 3 | # Copyright (C) 2010, Jason Baron <jbaron@redhat.com> |
4 | 4 | ||
5 | echo "int main(void) { entry: asm goto (\"\"::::entry); return 0; }" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" | 5 | cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" |
6 | int main(void) | ||
7 | { | ||
8 | #ifdef __arm__ | ||
9 | /* | ||
10 | * Not related to asm goto, but used by jump label | ||
11 | * and broken on some ARM GCC versions (see GCC Bug 48637). | ||
12 | */ | ||
13 | static struct { int dummy; int state; } tp; | ||
14 | asm (".long %c0" :: "i" (&tp.state)); | ||
15 | #endif | ||
16 | |||
17 | entry: | ||
18 | asm goto ("" :::: entry); | ||
19 | return 0; | ||
20 | } | ||
21 | END | ||
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index f32a04c4c5bc..0948c6b5a321 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -931,7 +931,7 @@ sub get_maintainer_role { | |||
931 | my $start = find_starting_index($index); | 931 | my $start = find_starting_index($index); |
932 | my $end = find_ending_index($index); | 932 | my $end = find_ending_index($index); |
933 | 933 | ||
934 | my $role; | 934 | my $role = "unknown"; |
935 | my $subsystem = $typevalue[$start]; | 935 | my $subsystem = $typevalue[$start]; |
936 | if (length($subsystem) > 20) { | 936 | if (length($subsystem) > 20) { |
937 | $subsystem = substr($subsystem, 0, 17); | 937 | $subsystem = substr($subsystem, 0, 17); |
@@ -1027,8 +1027,13 @@ sub add_categories { | |||
1027 | if ($email_list) { | 1027 | if ($email_list) { |
1028 | if (!$hash_list_to{lc($list_address)}) { | 1028 | if (!$hash_list_to{lc($list_address)}) { |
1029 | $hash_list_to{lc($list_address)} = 1; | 1029 | $hash_list_to{lc($list_address)} = 1; |
1030 | push(@list_to, [$list_address, | 1030 | if ($list_additional =~ m/moderated/) { |
1031 | "open list${list_role}"]); | 1031 | push(@list_to, [$list_address, |
1032 | "moderated list${list_role}"]); | ||
1033 | } else { | ||
1034 | push(@list_to, [$list_address, | ||
1035 | "open list${list_role}"]); | ||
1036 | } | ||
1032 | } | 1037 | } |
1033 | } | 1038 | } |
1034 | } | 1039 | } |
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 7957e7a5166a..64ac2380e4d5 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl | |||
@@ -19,6 +19,7 @@ | |||
19 | # 3) Check for leaked CONFIG_ symbols | 19 | # 3) Check for leaked CONFIG_ symbols |
20 | 20 | ||
21 | use strict; | 21 | use strict; |
22 | use File::Basename; | ||
22 | 23 | ||
23 | my ($dir, $arch, @files) = @ARGV; | 24 | my ($dir, $arch, @files) = @ARGV; |
24 | 25 | ||
@@ -99,6 +100,39 @@ sub check_asm_types | |||
99 | } | 100 | } |
100 | 101 | ||
101 | my $linux_types; | 102 | my $linux_types; |
103 | my %import_stack = (); | ||
104 | sub check_include_typesh | ||
105 | { | ||
106 | my $path = $_[0]; | ||
107 | my $import_path; | ||
108 | |||
109 | my $fh; | ||
110 | my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path); | ||
111 | for my $possible ( @file_paths ) { | ||
112 | if (not $import_stack{$possible} and open($fh, '<', $possible)) { | ||
113 | $import_path = $possible; | ||
114 | $import_stack{$import_path} = 1; | ||
115 | last; | ||
116 | } | ||
117 | } | ||
118 | if (eof $fh) { | ||
119 | return; | ||
120 | } | ||
121 | |||
122 | my $line; | ||
123 | while ($line = <$fh>) { | ||
124 | if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) { | ||
125 | $linux_types = 1; | ||
126 | last; | ||
127 | } | ||
128 | if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { | ||
129 | check_include_typesh($included); | ||
130 | } | ||
131 | } | ||
132 | close $fh; | ||
133 | delete $import_stack{$import_path}; | ||
134 | } | ||
135 | |||
102 | sub check_sizetypes | 136 | sub check_sizetypes |
103 | { | 137 | { |
104 | if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { | 138 | if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { |
@@ -113,6 +147,9 @@ sub check_sizetypes | |||
113 | $linux_types = 1; | 147 | $linux_types = 1; |
114 | return; | 148 | return; |
115 | } | 149 | } |
150 | if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { | ||
151 | check_include_typesh($included); | ||
152 | } | ||
116 | if ($line =~ m/__[us](8|16|32|64)\b/) { | 153 | if ($line =~ m/__[us](8|16|32|64)\b/) { |
117 | printf STDERR "$filename:$lineno: " . | 154 | printf STDERR "$filename:$lineno: " . |
118 | "found __[us]{8,16,32,64} type " . | 155 | "found __[us]{8,16,32,64} type " . |
@@ -122,4 +159,3 @@ sub check_sizetypes | |||
122 | #$ret = 1; | 159 | #$ret = 1; |
123 | } | 160 | } |
124 | } | 161 | } |
125 | |||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 7c7a5a6cc3f5..0586085136d1 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -344,10 +344,8 @@ setsym: | |||
344 | 344 | ||
345 | int conf_read(const char *name) | 345 | int conf_read(const char *name) |
346 | { | 346 | { |
347 | struct symbol *sym, *choice_sym; | 347 | struct symbol *sym; |
348 | struct property *prop; | 348 | int i; |
349 | struct expr *e; | ||
350 | int i, flags; | ||
351 | 349 | ||
352 | sym_set_change_count(0); | 350 | sym_set_change_count(0); |
353 | 351 | ||
@@ -357,7 +355,7 @@ int conf_read(const char *name) | |||
357 | for_all_symbols(i, sym) { | 355 | for_all_symbols(i, sym) { |
358 | sym_calc_value(sym); | 356 | sym_calc_value(sym); |
359 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) | 357 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) |
360 | goto sym_ok; | 358 | continue; |
361 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { | 359 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { |
362 | /* check that calculated value agrees with saved value */ | 360 | /* check that calculated value agrees with saved value */ |
363 | switch (sym->type) { | 361 | switch (sym->type) { |
@@ -366,30 +364,18 @@ int conf_read(const char *name) | |||
366 | if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) | 364 | if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) |
367 | break; | 365 | break; |
368 | if (!sym_is_choice(sym)) | 366 | if (!sym_is_choice(sym)) |
369 | goto sym_ok; | 367 | continue; |
370 | /* fall through */ | 368 | /* fall through */ |
371 | default: | 369 | default: |
372 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) | 370 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
373 | goto sym_ok; | 371 | continue; |
374 | break; | 372 | break; |
375 | } | 373 | } |
376 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) | 374 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) |
377 | /* no previous value and not saved */ | 375 | /* no previous value and not saved */ |
378 | goto sym_ok; | 376 | continue; |
379 | conf_unsaved++; | 377 | conf_unsaved++; |
380 | /* maybe print value in verbose mode... */ | 378 | /* maybe print value in verbose mode... */ |
381 | sym_ok: | ||
382 | if (!sym_is_choice(sym)) | ||
383 | continue; | ||
384 | /* The choice symbol only has a set value (and thus is not new) | ||
385 | * if all its visible childs have values. | ||
386 | */ | ||
387 | prop = sym_get_choice_prop(sym); | ||
388 | flags = sym->flags; | ||
389 | expr_list_for_each_sym(prop->expr, e, choice_sym) | ||
390 | if (choice_sym->visible != no) | ||
391 | flags &= choice_sym->flags; | ||
392 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
393 | } | 379 | } |
394 | 380 | ||
395 | for_all_symbols(i, sym) { | 381 | for_all_symbols(i, sym) { |
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index ceadf0e150cf..974d5cb7e30a 100644..100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
@@ -31,10 +31,12 @@ usage() { | |||
31 | echo " -h display this help text" | 31 | echo " -h display this help text" |
32 | echo " -m only merge the fragments, do not execute the make command" | 32 | echo " -m only merge the fragments, do not execute the make command" |
33 | echo " -n use allnoconfig instead of alldefconfig" | 33 | echo " -n use allnoconfig instead of alldefconfig" |
34 | echo " -r list redundant entries when merging fragments" | ||
34 | } | 35 | } |
35 | 36 | ||
36 | MAKE=true | 37 | MAKE=true |
37 | ALLTARGET=alldefconfig | 38 | ALLTARGET=alldefconfig |
39 | WARNREDUN=false | ||
38 | 40 | ||
39 | while true; do | 41 | while true; do |
40 | case $1 in | 42 | case $1 in |
@@ -52,18 +54,27 @@ while true; do | |||
52 | usage | 54 | usage |
53 | exit | 55 | exit |
54 | ;; | 56 | ;; |
57 | "-r") | ||
58 | WARNREDUN=true | ||
59 | shift | ||
60 | continue | ||
61 | ;; | ||
55 | *) | 62 | *) |
56 | break | 63 | break |
57 | ;; | 64 | ;; |
58 | esac | 65 | esac |
59 | done | 66 | done |
60 | 67 | ||
61 | 68 | INITFILE=$1 | |
69 | shift; | ||
62 | 70 | ||
63 | MERGE_LIST=$* | 71 | MERGE_LIST=$* |
64 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" | 72 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" |
65 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | 73 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) |
66 | 74 | ||
75 | echo "Using $INITFILE as base" | ||
76 | cat $INITFILE > $TMP_FILE | ||
77 | |||
67 | # Merge files, printing warnings on overrided values | 78 | # Merge files, printing warnings on overrided values |
68 | for MERGE_FILE in $MERGE_LIST ; do | 79 | for MERGE_FILE in $MERGE_LIST ; do |
69 | echo "Merging $MERGE_FILE" | 80 | echo "Merging $MERGE_FILE" |
@@ -79,6 +90,8 @@ for MERGE_FILE in $MERGE_LIST ; do | |||
79 | echo Previous value: $PREV_VAL | 90 | echo Previous value: $PREV_VAL |
80 | echo New value: $NEW_VAL | 91 | echo New value: $NEW_VAL |
81 | echo | 92 | echo |
93 | elif [ "$WARNREDUN" = "true" ]; then | ||
94 | echo Value of $CFG is redundant by fragment $MERGE_FILE: | ||
82 | fi | 95 | fi |
83 | sed -i "/$CFG[ =]/d" $TMP_FILE | 96 | sed -i "/$CFG[ =]/d" $TMP_FILE |
84 | fi | 97 | fi |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 071f00c3046e..22a3c400fc41 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -262,11 +262,18 @@ static struct symbol *sym_calc_choice(struct symbol *sym) | |||
262 | struct symbol *def_sym; | 262 | struct symbol *def_sym; |
263 | struct property *prop; | 263 | struct property *prop; |
264 | struct expr *e; | 264 | struct expr *e; |
265 | int flags; | ||
265 | 266 | ||
266 | /* first calculate all choice values' visibilities */ | 267 | /* first calculate all choice values' visibilities */ |
268 | flags = sym->flags; | ||
267 | prop = sym_get_choice_prop(sym); | 269 | prop = sym_get_choice_prop(sym); |
268 | expr_list_for_each_sym(prop->expr, e, def_sym) | 270 | expr_list_for_each_sym(prop->expr, e, def_sym) { |
269 | sym_calc_visibility(def_sym); | 271 | sym_calc_visibility(def_sym); |
272 | if (def_sym->visible != no) | ||
273 | flags &= def_sym->flags; | ||
274 | } | ||
275 | |||
276 | sym->flags &= flags | ~SYMBOL_DEF_USER; | ||
270 | 277 | ||
271 | /* is the user choice visible? */ | 278 | /* is the user choice visible? */ |
272 | def_sym = sym->def[S_DEF_USER].val; | 279 | def_sym = sym->def[S_DEF_USER].val; |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index b89efe6e4c85..8e730ccc3f2b 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1029,6 +1029,31 @@ static int do_amba_entry(const char *filename, | |||
1029 | } | 1029 | } |
1030 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); | 1030 | ADD_TO_DEVTABLE("amba", struct amba_id, do_amba_entry); |
1031 | 1031 | ||
1032 | /* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* | ||
1033 | * All fields are numbers. It would be nicer to use strings for vendor | ||
1034 | * and feature, but getting those out of the build system here is too | ||
1035 | * complicated. | ||
1036 | */ | ||
1037 | |||
1038 | static int do_x86cpu_entry(const char *filename, struct x86_cpu_id *id, | ||
1039 | char *alias) | ||
1040 | { | ||
1041 | id->feature = TO_NATIVE(id->feature); | ||
1042 | id->family = TO_NATIVE(id->family); | ||
1043 | id->model = TO_NATIVE(id->model); | ||
1044 | id->vendor = TO_NATIVE(id->vendor); | ||
1045 | |||
1046 | strcpy(alias, "x86cpu:"); | ||
1047 | ADD(alias, "vendor:", id->vendor != X86_VENDOR_ANY, id->vendor); | ||
1048 | ADD(alias, ":family:", id->family != X86_FAMILY_ANY, id->family); | ||
1049 | ADD(alias, ":model:", id->model != X86_MODEL_ANY, id->model); | ||
1050 | strcat(alias, ":feature:*"); | ||
1051 | if (id->feature != X86_FEATURE_ANY) | ||
1052 | sprintf(alias + strlen(alias), "%04X*", id->feature); | ||
1053 | return 1; | ||
1054 | } | ||
1055 | ADD_TO_DEVTABLE("x86cpu", struct x86_cpu_id, do_x86cpu_entry); | ||
1056 | |||
1032 | /* Does namelen bytes of name exactly match the symbol? */ | 1057 | /* Does namelen bytes of name exactly match the symbol? */ |
1033 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1058 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1034 | { | 1059 | { |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9adb667dd31a..3f01fd908730 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -849,7 +849,7 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
849 | 849 | ||
850 | #define ALL_INIT_DATA_SECTIONS \ | 850 | #define ALL_INIT_DATA_SECTIONS \ |
851 | ".init.setup$", ".init.rodata$", \ | 851 | ".init.setup$", ".init.rodata$", \ |
852 | ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \ | 852 | ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$", \ |
853 | ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" | 853 | ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" |
854 | #define ALL_EXIT_DATA_SECTIONS \ | 854 | #define ALL_EXIT_DATA_SECTIONS \ |
855 | ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" | 855 | ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 3c6c0b14c807..eee5f8ed2493 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -97,6 +97,7 @@ mkdir -m 755 -p "$libc_headers_dir/DEBIAN" | |||
97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" | 97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" |
98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" | 98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" |
99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" | 99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" |
100 | mkdir -p "$kernel_headers_dir/lib/modules/$version/" | ||
100 | if [ "$ARCH" = "um" ] ; then | 101 | if [ "$ARCH" = "um" ] ; then |
101 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" | 102 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" |
102 | fi | 103 | fi |
@@ -120,15 +121,19 @@ else | |||
120 | fi | 121 | fi |
121 | 122 | ||
122 | if grep -q '^CONFIG_MODULES=y' .config ; then | 123 | if grep -q '^CONFIG_MODULES=y' .config ; then |
123 | INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install | 124 | INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install |
125 | rm -f "$tmpdir/lib/modules/$version/build" | ||
126 | rm -f "$tmpdir/lib/modules/$version/source" | ||
124 | if [ "$ARCH" = "um" ] ; then | 127 | if [ "$ARCH" = "um" ] ; then |
125 | mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" | 128 | mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" |
126 | rmdir "$tmpdir/lib/modules/$version" | 129 | rmdir "$tmpdir/lib/modules/$version" |
127 | fi | 130 | fi |
128 | fi | 131 | fi |
129 | 132 | ||
130 | make headers_check | 133 | if [ "$ARCH" != "um" ]; then |
131 | make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" | 134 | $MAKE headers_check KBUILD_SRC= |
135 | $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" | ||
136 | fi | ||
132 | 137 | ||
133 | # Install the maintainer scripts | 138 | # Install the maintainer scripts |
134 | # Note: hook scripts under /etc/kernel are also executed by official Debian | 139 | # Note: hook scripts under /etc/kernel are also executed by official Debian |
@@ -245,6 +250,7 @@ destdir=$kernel_headers_dir/usr/src/linux-headers-$version | |||
245 | mkdir -p "$destdir" | 250 | mkdir -p "$destdir" |
246 | (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) | 251 | (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) |
247 | (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) | 252 | (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) |
253 | ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" | ||
248 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" | 254 | rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" |
249 | arch=$(dpkg --print-architecture) | 255 | arch=$(dpkg --print-architecture) |
250 | 256 | ||
@@ -259,8 +265,6 @@ Description: Linux kernel headers for $KERNELRELEASE on $arch | |||
259 | This is useful for people who need to build external modules | 265 | This is useful for people who need to build external modules |
260 | EOF | 266 | EOF |
261 | 267 | ||
262 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
263 | |||
264 | # Do we have firmware? Move it out of the way and build it into a package. | 268 | # Do we have firmware? Move it out of the way and build it into a package. |
265 | if [ -e "$tmpdir/lib/firmware" ]; then | 269 | if [ -e "$tmpdir/lib/firmware" ]; then |
266 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" | 270 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" |
@@ -287,7 +291,11 @@ Description: Linux support headers for userspace development | |||
287 | are used by the installed headers for GNU glibc and other system libraries. | 291 | are used by the installed headers for GNU glibc and other system libraries. |
288 | EOF | 292 | EOF |
289 | 293 | ||
290 | create_package "$libc_headers_packagename" "$libc_headers_dir" | 294 | if [ "$ARCH" != "um" ]; then |
295 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
296 | create_package "$libc_headers_packagename" "$libc_headers_dir" | ||
297 | fi | ||
298 | |||
291 | create_package "$packagename" "$tmpdir" | 299 | create_package "$packagename" "$tmpdir" |
292 | 300 | ||
293 | exit 0 | 301 | exit 0 |
diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 20fb25c23382..d000ea3a41fd 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel | |||
@@ -116,6 +116,10 @@ findFile () { | |||
116 | ext=".bz2" | 116 | ext=".bz2" |
117 | name="bzip2" | 117 | name="bzip2" |
118 | uncomp="bunzip2 -dc" | 118 | uncomp="bunzip2 -dc" |
119 | elif [ -r ${filebase}.xz ]; then | ||
120 | ext=".xz" | ||
121 | name="xz" | ||
122 | uncomp="xz -dc" | ||
119 | elif [ -r ${filebase}.zip ]; then | 123 | elif [ -r ${filebase}.zip ]; then |
120 | ext=".zip" | 124 | ext=".zip" |
121 | name="zip" | 125 | name="zip" |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 4d403844e137..bd6dca8a0ab2 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -75,8 +75,7 @@ scm_version() | |||
75 | [ -w . ] && git update-index --refresh --unmerged > /dev/null | 75 | [ -w . ] && git update-index --refresh --unmerged > /dev/null |
76 | 76 | ||
77 | # Check for uncommitted changes | 77 | # Check for uncommitted changes |
78 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | 78 | if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then |
79 | | read dummy; then | ||
80 | printf '%s' -dirty | 79 | printf '%s' -dirty |
81 | fi | 80 | fi |
82 | 81 | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 833813a99e7c..0d6004e20658 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -116,7 +116,7 @@ docscope() | |||
116 | 116 | ||
117 | dogtags() | 117 | dogtags() |
118 | { | 118 | { |
119 | all_sources | gtags -f - | 119 | all_sources | gtags -i -f - |
120 | } | 120 | } |
121 | 121 | ||
122 | exuberant() | 122 | exuberant() |
@@ -166,9 +166,6 @@ exuberant() | |||
166 | all_defconfigs | xargs -r $1 -a \ | 166 | all_defconfigs | xargs -r $1 -a \ |
167 | --langdef=dotconfig --language-force=dotconfig \ | 167 | --langdef=dotconfig --language-force=dotconfig \ |
168 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' | 168 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' |
169 | |||
170 | # Remove structure forward declarations. | ||
171 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags | ||
172 | } | 169 | } |
173 | 170 | ||
174 | emacs() | 171 | emacs() |
@@ -233,6 +230,7 @@ if [ "${ARCH}" = "um" ]; then | |||
233 | fi | 230 | fi |
234 | fi | 231 | fi |
235 | 232 | ||
233 | remove_structs= | ||
236 | case "$1" in | 234 | case "$1" in |
237 | "cscope") | 235 | "cscope") |
238 | docscope | 236 | docscope |
@@ -245,10 +243,17 @@ case "$1" in | |||
245 | "tags") | 243 | "tags") |
246 | rm -f tags | 244 | rm -f tags |
247 | xtags ctags | 245 | xtags ctags |
246 | remove_structs=y | ||
248 | ;; | 247 | ;; |
249 | 248 | ||
250 | "TAGS") | 249 | "TAGS") |
251 | rm -f TAGS | 250 | rm -f TAGS |
252 | xtags etags | 251 | xtags etags |
252 | remove_structs=y | ||
253 | ;; | 253 | ;; |
254 | esac | 254 | esac |
255 | |||
256 | # Remove structure forward declarations. | ||
257 | if [ -n $remove_structs ]; then | ||
258 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 | ||
259 | fi | ||