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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull non-critical part of kbuild from Michal Marek:
- New semantic patches, make coccicheck M= fix
- make gtags speedup
- make tags/TAGS always removes struct forward declarations
- make deb-pkg fixes (some patches are still pending, I know)
- scripts/patch-kernel fix from the last user of this script ;)

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
scripts/patch-kernel: digest kernel.org hosted .xz patches
scripts/coccinelle/api/ptr_ret.cocci: semantic patch for ptr_err
scripts: refactor remove structure forward declarations
kbuild: incremental tags update for GNU Global
coccinelle: semantic patch for bool issues
coccinelle: semantic patch to check for PTR_ERR after reassignment
coccinelle: semantic patch converting 0 test to null test
coccinelle: semantic patch for missing iounmap
coccinelle: semantic patch for missing clk_put
kbuild: Fix out-of-tree build for 'make deb-pkg'
kbuild: Only build linux-image package for UML
kbuild: Fix link to headers in 'make deb-pkg'
coccicheck: change handling of C={1,2} when M= is set

+687 -10
+70
scripts/coccinelle/api/ptr_ret.cocci
··· 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")
+67
scripts/coccinelle/free/clk_put.cocci
··· 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)
+67
scripts/coccinelle/free/iounmap.cocci
··· 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)
+178
scripts/coccinelle/misc/boolinit.cocci
··· 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")
+41
scripts/coccinelle/misc/cstptr.cocci
··· 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)
+237
scripts/coccinelle/null/badzero.cocci
··· 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")
+14 -6
scripts/package/builddeb
··· 97 97 mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" 98 98 mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" 99 99 mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" 100 + mkdir -p "$kernel_headers_dir/lib/modules/$version/" 100 101 if [ "$ARCH" = "um" ] ; then 101 102 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" 102 103 fi ··· 121 120 fi 122 121 123 122 if grep -q '^CONFIG_MODULES=y' .config ; then 124 - INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install 123 + INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install 124 + rm -f "$tmpdir/lib/modules/$version/build" 125 + rm -f "$tmpdir/lib/modules/$version/source" 125 126 if [ "$ARCH" = "um" ] ; then 126 127 mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" 127 128 rmdir "$tmpdir/lib/modules/$version" 128 129 fi 129 130 fi 130 131 131 - make headers_check 132 - make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" 132 + if [ "$ARCH" != "um" ]; then 133 + $MAKE headers_check KBUILD_SRC= 134 + $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" 135 + fi 133 136 134 137 # Install the maintainer scripts 135 138 # Note: hook scripts under /etc/kernel are also executed by official Debian ··· 250 245 mkdir -p "$destdir" 251 246 (cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) 252 247 (cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) 248 + ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" 253 249 rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" 254 250 arch=$(dpkg --print-architecture) 255 251 ··· 264 258 . 265 259 This is useful for people who need to build external modules 266 260 EOF 267 - 268 - create_package "$kernel_headers_packagename" "$kernel_headers_dir" 269 261 270 262 # Do we have firmware? Move it out of the way and build it into a package. 271 263 if [ -e "$tmpdir/lib/firmware" ]; then ··· 291 287 are used by the installed headers for GNU glibc and other system libraries. 292 288 EOF 293 289 294 - create_package "$libc_headers_packagename" "$libc_headers_dir" 290 + if [ "$ARCH" != "um" ]; then 291 + create_package "$kernel_headers_packagename" "$kernel_headers_dir" 292 + create_package "$libc_headers_packagename" "$libc_headers_dir" 293 + fi 294 + 295 295 create_package "$packagename" "$tmpdir" 296 296 297 297 exit 0
+4
scripts/patch-kernel
··· 116 116 ext=".bz2" 117 117 name="bzip2" 118 118 uncomp="bunzip2 -dc" 119 + elif [ -r ${filebase}.xz ]; then 120 + ext=".xz" 121 + name="xz" 122 + uncomp="xz -dc" 119 123 elif [ -r ${filebase}.zip ]; then 120 124 ext=".zip" 121 125 name="zip"
+9 -4
scripts/tags.sh
··· 116 116 117 117 dogtags() 118 118 { 119 - all_sources | gtags -f - 119 + all_sources | gtags -i -f - 120 120 } 121 121 122 122 exuberant() ··· 166 166 all_defconfigs | xargs -r $1 -a \ 167 167 --langdef=dotconfig --language-force=dotconfig \ 168 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 171 emacs() ··· 230 233 fi 231 234 fi 232 235 236 + remove_structs= 233 237 case "$1" in 234 238 "cscope") 235 239 docscope ··· 243 245 "tags") 244 246 rm -f tags 245 247 xtags ctags 248 + remove_structs=y 246 249 ;; 247 250 248 251 "TAGS") 249 252 rm -f TAGS 250 253 xtags etags 254 + remove_structs=y 251 255 ;; 252 256 esac 257 + 258 + # Remove structure forward declarations. 259 + if [ -n $remove_structs ]; then 260 + LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 261 + fi