Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull misc kbuild changes from Michal Marek:
"This is the non-critical part of kbuild for v3.6-rc1:

- Two new coccinelle semantic patches
- New scripts/tags.sh regexp
- scripts/config improvements that I mistakenly applied here instead
of in the kconfig branch (but there are no conflicts)
- Debian packaging fixes"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
scripts/tags.sh: Teach [ce]tags about libtraceeevent error codes
scripts/coccinelle: list iterator variable semantic patch
scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOT
deb-pkg: Add all Makefiles to header package
deb-pkg: Install linux-firmware-image in versioned dir
scripts/config: add option to undef a symbol
scripts/config: allow alternate prefix to config option symbol
scripts/config: add option to not upper-case symbols

+264 -21
+147
scripts/coccinelle/iterators/use_after_iter.cocci
··· 1 + /// If list_for_each_entry, etc complete a traversal of the list, the iterator 2 + /// variable ends up pointing to an address at an offset from the list head, 3 + /// and not a meaningful structure. Thus this value should not be used after 4 + /// the end of the iterator. 5 + //#False positives arise when there is a goto in the iterator and the 6 + //#reported reference is at the label of this goto. Some flag tests 7 + //#may also cause a report to be a false positive. 8 + /// 9 + // Confidence: Moderate 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: -no_includes -include_headers 15 + 16 + virtual context 17 + virtual org 18 + virtual report 19 + 20 + @r exists@ 21 + identifier c,member; 22 + expression E,x; 23 + iterator name list_for_each_entry; 24 + iterator name list_for_each_entry_reverse; 25 + iterator name list_for_each_entry_continue; 26 + iterator name list_for_each_entry_continue_reverse; 27 + iterator name list_for_each_entry_from; 28 + iterator name list_for_each_entry_safe; 29 + iterator name list_for_each_entry_safe_continue; 30 + iterator name list_for_each_entry_safe_from; 31 + iterator name list_for_each_entry_safe_reverse; 32 + iterator name hlist_for_each_entry; 33 + iterator name hlist_for_each_entry_continue; 34 + iterator name hlist_for_each_entry_from; 35 + iterator name hlist_for_each_entry_safe; 36 + statement S; 37 + position p1,p2; 38 + @@ 39 + 40 + ( 41 + list_for_each_entry@p1(c,...,member) { ... when != break; 42 + when forall 43 + when strict 44 + } 45 + | 46 + list_for_each_entry_reverse@p1(c,...,member) { ... when != break; 47 + when forall 48 + when strict 49 + } 50 + | 51 + list_for_each_entry_continue@p1(c,...,member) { ... when != break; 52 + when forall 53 + when strict 54 + } 55 + | 56 + list_for_each_entry_continue_reverse@p1(c,...,member) { ... when != break; 57 + when forall 58 + when strict 59 + } 60 + | 61 + list_for_each_entry_from@p1(c,...,member) { ... when != break; 62 + when forall 63 + when strict 64 + } 65 + | 66 + list_for_each_entry_safe@p1(c,...,member) { ... when != break; 67 + when forall 68 + when strict 69 + } 70 + | 71 + list_for_each_entry_safe_continue@p1(c,...,member) { ... when != break; 72 + when forall 73 + when strict 74 + } 75 + | 76 + list_for_each_entry_safe_from@p1(c,...,member) { ... when != break; 77 + when forall 78 + when strict 79 + } 80 + | 81 + list_for_each_entry_safe_reverse@p1(c,...,member) { ... when != break; 82 + when forall 83 + when strict 84 + } 85 + ) 86 + ... 87 + ( 88 + list_for_each_entry(c,...) S 89 + | 90 + list_for_each_entry_reverse(c,...) S 91 + | 92 + list_for_each_entry_continue(c,...) S 93 + | 94 + list_for_each_entry_continue_reverse(c,...) S 95 + | 96 + list_for_each_entry_from(c,...) S 97 + | 98 + list_for_each_entry_safe(c,...) S 99 + | 100 + list_for_each_entry_safe(x,c,...) S 101 + | 102 + list_for_each_entry_safe_continue(c,...) S 103 + | 104 + list_for_each_entry_safe_continue(x,c,...) S 105 + | 106 + list_for_each_entry_safe_from(c,...) S 107 + | 108 + list_for_each_entry_safe_from(x,c,...) S 109 + | 110 + list_for_each_entry_safe_reverse(c,...) S 111 + | 112 + list_for_each_entry_safe_reverse(x,c,...) S 113 + | 114 + hlist_for_each_entry(c,...) S 115 + | 116 + hlist_for_each_entry_continue(c,...) S 117 + | 118 + hlist_for_each_entry_from(c,...) S 119 + | 120 + hlist_for_each_entry_safe(c,...) S 121 + | 122 + list_remove_head(x,c,...) 123 + | 124 + sizeof(<+...c...+>) 125 + | 126 + &c->member 127 + | 128 + c = E 129 + | 130 + *c@p2 131 + ) 132 + 133 + @script:python depends on org@ 134 + p1 << r.p1; 135 + p2 << r.p2; 136 + @@ 137 + 138 + cocci.print_main("invalid iterator index reference",p2) 139 + cocci.print_secs("iterator",p1) 140 + 141 + @script:python depends on report@ 142 + p1 << r.p1; 143 + p2 << r.p2; 144 + @@ 145 + 146 + msg = "ERROR: invalid reference to the index variable of the iterator on line %s" % (p1[0].line) 147 + coccilib.report.print_report(p2[0], msg)
+65
scripts/coccinelle/misc/irqf_oneshot.cocci
··· 1 + /// Make sure threaded IRQs without a primary handler are always request with 2 + /// IRQF_ONESHOT 3 + /// 4 + // 5 + // Confidence: Good 6 + // Comments: 7 + // Options: --no-includes 8 + 9 + virtual patch 10 + virtual context 11 + virtual org 12 + virtual report 13 + 14 + @r1@ 15 + expression irq; 16 + expression thread_fn; 17 + expression flags; 18 + position p; 19 + @@ 20 + request_threaded_irq@p(irq, NULL, thread_fn, 21 + ( 22 + flags | IRQF_ONESHOT 23 + | 24 + IRQF_ONESHOT 25 + ) 26 + , ...) 27 + 28 + @depends on patch@ 29 + expression irq; 30 + expression thread_fn; 31 + expression flags; 32 + position p != r1.p; 33 + @@ 34 + request_threaded_irq@p(irq, NULL, thread_fn, 35 + ( 36 + -0 37 + +IRQF_ONESHOT 38 + | 39 + -flags 40 + +flags | IRQF_ONESHOT 41 + ) 42 + , ...) 43 + 44 + @depends on context@ 45 + position p != r1.p; 46 + @@ 47 + *request_threaded_irq@p(...) 48 + 49 + @match depends on report || org@ 50 + expression irq; 51 + position p != r1.p; 52 + @@ 53 + request_threaded_irq@p(irq, NULL, ...) 54 + 55 + @script:python depends on org@ 56 + p << match.p; 57 + @@ 58 + msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT" 59 + coccilib.org.print_todo(p[0],msg) 60 + 61 + @script:python depends on report@ 62 + p << match.p; 63 + @@ 64 + msg = "ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT" 65 + coccilib.report.print_report(p[0],msg)
+44 -16
scripts/config
··· 1 1 #!/bin/bash 2 2 # Manipulate options in a .config file from the command line 3 3 4 + # If no prefix forced, use the default CONFIG_ 5 + CONFIG_="${CONFIG_-CONFIG_}" 6 + 4 7 usage() { 5 8 cat >&2 <<EOL 6 9 Manipulate options in a .config file from the command line. ··· 17 14 Set option to "string" 18 15 --set-val option value 19 16 Set option to value 17 + --undefine|-u option Undefine option 20 18 --state|-s option Print state of option (n,y,m,undef) 21 19 22 20 --enable-after|-E beforeopt option ··· 30 26 commands can be repeated multiple times 31 27 32 28 options: 33 - --file .config file to change (default .config) 29 + --file config-file .config file to change (default .config) 30 + --keep-case|-k Keep next symbols' case (dont' upper-case it) 34 31 35 32 config doesn't check the validity of the .config file. This is done at next 36 - make time. 33 + make time. 34 + 35 + By default, config will upper-case the given symbol. Use --keep-case to keep 36 + the case of all following symbols unchanged. 37 + 38 + config uses 'CONFIG_' as the default symbol prefix. Set the environment 39 + variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ... 37 40 EOL 38 41 exit 1 39 42 } ··· 51 40 usage 52 41 fi 53 42 case "$ARG" in 54 - CONFIG_*) 55 - ARG="${ARG/CONFIG_/}" 43 + ${CONFIG_}*) 44 + ARG="${ARG/${CONFIG_}/}" 56 45 ;; 57 46 esac 58 - ARG="`echo $ARG | tr a-z A-Z`" 47 + if [ "$MUNGE_CASE" = "yes" ] ; then 48 + ARG="`echo $ARG | tr a-z A-Z`" 49 + fi 59 50 } 60 51 61 52 set_var() { ··· 74 61 fi 75 62 } 76 63 64 + undef_var() { 65 + local name=$1 66 + 67 + sed -ri "/^($name=|# $name is not set)/d" "$FN" 68 + } 69 + 77 70 if [ "$1" = "--file" ]; then 78 71 FN="$2" 79 72 if [ "$FN" = "" ] ; then ··· 94 75 usage 95 76 fi 96 77 78 + MUNGE_CASE=yes 97 79 while [ "$1" != "" ] ; do 98 80 CMD="$1" 99 81 shift 100 82 case "$CMD" in 83 + --keep-case|-k) 84 + MUNGE_CASE=no 85 + shift 86 + continue 87 + ;; 101 88 --refresh) 102 89 ;; 103 90 --*-after) ··· 120 95 esac 121 96 case "$CMD" in 122 97 --enable|-e) 123 - set_var "CONFIG_$ARG" "CONFIG_$ARG=y" 98 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y" 124 99 ;; 125 100 126 101 --disable|-d) 127 - set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set" 102 + set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set" 128 103 ;; 129 104 130 105 --module|-m) 131 - set_var "CONFIG_$ARG" "CONFIG_$ARG=m" 106 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m" 132 107 ;; 133 108 134 109 --set-str) 135 110 # sed swallows one level of escaping, so we need double-escaping 136 - set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\"" 111 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\"" 137 112 shift 138 113 ;; 139 114 140 115 --set-val) 141 - set_var "CONFIG_$ARG" "CONFIG_$ARG=$1" 116 + set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1" 142 117 shift 118 + ;; 119 + --undefine|-u) 120 + undef_var "${CONFIG_}$ARG" 143 121 ;; 144 122 145 123 --state|-s) 146 - if grep -q "# CONFIG_$ARG is not set" $FN ; then 124 + if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then 147 125 echo n 148 126 else 149 - V="$(grep "^CONFIG_$ARG=" $FN)" 127 + V="$(grep "^${CONFIG_}$ARG=" $FN)" 150 128 if [ $? != 0 ] ; then 151 129 echo undef 152 130 else 153 - V="${V/#CONFIG_$ARG=/}" 131 + V="${V/#${CONFIG_}$ARG=/}" 154 132 V="${V/#\"/}" 155 133 V="${V/%\"/}" 156 134 V="${V//\\\"/\"}" ··· 163 135 ;; 164 136 165 137 --enable-after|-E) 166 - set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A" 138 + set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A" 167 139 ;; 168 140 169 141 --disable-after|-D) 170 - set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A" 142 + set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A" 171 143 ;; 172 144 173 145 --module-after|-M) 174 - set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A" 146 + set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A" 175 147 ;; 176 148 177 149 # undocumented because it ignores --file (fixme)
+4 -3
scripts/package/builddeb
··· 92 92 mkdir -m 755 -p "$tmpdir/DEBIAN" 93 93 mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 94 94 mkdir -m 755 -p "$fwdir/DEBIAN" 95 - mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" 95 + mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename" 96 96 mkdir -m 755 -p "$libc_headers_dir/DEBIAN" 97 97 mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" 98 98 mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" ··· 243 243 fi 244 244 245 245 # Build header package 246 - (cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 246 + (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") 247 247 (cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") 248 248 (cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") 249 249 destdir=$kernel_headers_dir/usr/src/linux-headers-$version ··· 267 267 268 268 # Do we have firmware? Move it out of the way and build it into a package. 269 269 if [ -e "$tmpdir/lib/firmware" ]; then 270 - mv "$tmpdir/lib/firmware" "$fwdir/lib/" 270 + mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/" 271 + rmdir "$tmpdir/lib/firmware" 271 272 272 273 cat <<EOF >> debian/control 273 274
+4 -2
scripts/tags.sh
··· 153 153 --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 154 154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 155 155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 156 - --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 156 + --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ 157 + --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' 157 158 158 159 all_kconfigs | xargs $1 -a \ 159 160 --langdef=kconfig --language-force=kconfig \ ··· 196 195 --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ 197 196 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 198 197 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 199 - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' 198 + --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ 199 + --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' 200 200 201 201 all_kconfigs | xargs $1 -a \ 202 202 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'