Merge branch 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux

Pull coccinelle updates from Julia Lawall.

* 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
scripts: coccicheck: Correct usage of make coccicheck
coccinelle: update expiring email addresses
coccinnelle: Remove ptr_ret script
kbuild: do not use scripts/ld-version.sh for checking spatch version
remove boolinit.cocci

+20 -306
+2 -2
MAINTAINERS
··· 4355 F: drivers/media/pci/cobalt/ 4356 4357 COCCINELLE/Semantic Patches (SmPL) 4358 - M: Julia Lawall <Julia.Lawall@lip6.fr> 4359 - M: Gilles Muller <Gilles.Muller@lip6.fr> 4360 M: Nicolas Palix <nicolas.palix@imag.fr> 4361 M: Michal Marek <michal.lkml@markovi.net> 4362 L: cocci@systeme.lip6.fr (moderated for non-subscribers)
··· 4355 F: drivers/media/pci/cobalt/ 4356 4357 COCCINELLE/Semantic Patches (SmPL) 4358 + M: Julia Lawall <Julia.Lawall@inria.fr> 4359 + M: Gilles Muller <Gilles.Muller@inria.fr> 4360 M: Nicolas Palix <nicolas.palix@imag.fr> 4361 M: Michal Marek <michal.lkml@markovi.net> 4362 L: cocci@systeme.lip6.fr (moderated for non-subscribers)
+17 -9
scripts/coccicheck
··· 16 fi 17 18 SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') 19 - SPATCH_VERSION_NUM=$(echo $SPATCH_VERSION | ${DIR}/scripts/ld-version.sh) 20 21 USE_JOBS="no" 22 $SPATCH --help | grep "\-\-jobs" > /dev/null && USE_JOBS="yes" ··· 59 60 if [ "$C" = "1" -o "$C" = "2" ]; then 61 ONLINE=1 62 63 # Take only the last argument, which is the C file to test 64 shift $(( $# - 1 )) ··· 197 198 OPT=`grep "Options:" $COCCI | cut -d':' -f2` 199 REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` 200 - REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) 201 - if [ "$REQ_NUM" != "0" ] ; then 202 - if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then 203 - echo "Skipping coccinelle SmPL patch: $COCCI" 204 - echo "You have coccinelle: $SPATCH_VERSION" 205 - echo "This SmPL patch requires: $REQ" 206 - return 207 - fi 208 fi 209 210 # The option '--parse-cocci' can be used to syntactically check the SmPL files.
··· 16 fi 17 18 SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') 19 20 USE_JOBS="no" 21 $SPATCH --help | grep "\-\-jobs" > /dev/null && USE_JOBS="yes" ··· 60 61 if [ "$C" = "1" -o "$C" = "2" ]; then 62 ONLINE=1 63 + 64 + if [[ $# -le 0 ]]; then 65 + echo '' 66 + echo 'Specifying both the variable "C" and rule "coccicheck" in the make 67 + command results in a shift count error.' 68 + echo '' 69 + echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.' 70 + echo '' 71 + echo 'Example: make C=2 CHECK=scripts/coccicheck drivers/net/ethernet/ethoc.o' 72 + echo '' 73 + exit 1 74 + fi 75 76 # Take only the last argument, which is the C file to test 77 shift $(( $# - 1 )) ··· 186 187 OPT=`grep "Options:" $COCCI | cut -d':' -f2` 188 REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` 189 + if [ -n "$REQ" ] && ! { echo "$REQ"; echo "$SPATCH_VERSION"; } | sort -CV ; then 190 + echo "Skipping coccinelle SmPL patch: $COCCI" 191 + echo "You have coccinelle: $SPATCH_VERSION" 192 + echo "This SmPL patch requires: $REQ" 193 + return 194 fi 195 196 # The option '--parse-cocci' can be used to syntactically check the SmPL files.
-97
scripts/coccinelle/api/ptr_ret.cocci
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /// 3 - /// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR 4 - /// 5 - // Confidence: High 6 - // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. 7 - // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. 8 - // URL: http://coccinelle.lip6.fr/ 9 - // Options: --no-includes --include-headers 10 - // 11 - // Keywords: ERR_PTR, PTR_ERR, PTR_ERR_OR_ZERO 12 - // Version min: 2.6.39 13 - // 14 - 15 - virtual context 16 - virtual patch 17 - virtual org 18 - virtual report 19 - 20 - @depends on patch@ 21 - expression ptr; 22 - @@ 23 - 24 - - if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; 25 - + return PTR_ERR_OR_ZERO(ptr); 26 - 27 - @depends on patch@ 28 - expression ptr; 29 - @@ 30 - 31 - - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 32 - + return PTR_ERR_OR_ZERO(ptr); 33 - 34 - @depends on patch@ 35 - expression ptr; 36 - @@ 37 - 38 - - (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) 39 - + PTR_ERR_OR_ZERO(ptr) 40 - 41 - @r1 depends on !patch@ 42 - expression ptr; 43 - position p1; 44 - @@ 45 - 46 - * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; 47 - 48 - @r2 depends on !patch@ 49 - expression ptr; 50 - position p2; 51 - @@ 52 - 53 - * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 54 - 55 - @r3 depends on !patch@ 56 - expression ptr; 57 - position p3; 58 - @@ 59 - 60 - * IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0 61 - 62 - @script:python depends on org@ 63 - p << r1.p1; 64 - @@ 65 - 66 - coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") 67 - 68 - 69 - @script:python depends on org@ 70 - p << r2.p2; 71 - @@ 72 - 73 - coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") 74 - 75 - @script:python depends on org@ 76 - p << r3.p3; 77 - @@ 78 - 79 - coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") 80 - 81 - @script:python depends on report@ 82 - p << r1.p1; 83 - @@ 84 - 85 - coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") 86 - 87 - @script:python depends on report@ 88 - p << r2.p2; 89 - @@ 90 - 91 - coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used") 92 - 93 - @script:python depends on report@ 94 - p << r3.p3; 95 - @@ 96 - 97 - coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
···
-195
scripts/coccinelle/misc/boolinit.cocci
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /// Bool initializations should use true and false. Bool tests don't need 3 - /// comparisons. Based on contributions from Joe Perches, Rusty Russell 4 - /// and Bruce W Allan. 5 - /// 6 - // Confidence: High 7 - // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. 8 - // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. 9 - // URL: http://coccinelle.lip6.fr/ 10 - // Options: --include-headers 11 - 12 - virtual patch 13 - virtual context 14 - virtual org 15 - virtual report 16 - 17 - @boolok@ 18 - symbol true,false; 19 - @@ 20 - ( 21 - true 22 - | 23 - false 24 - ) 25 - 26 - @depends on patch@ 27 - bool t; 28 - @@ 29 - 30 - ( 31 - - t == true 32 - + t 33 - | 34 - - true == t 35 - + t 36 - | 37 - - t != true 38 - + !t 39 - | 40 - - true != t 41 - + !t 42 - | 43 - - t == false 44 - + !t 45 - | 46 - - false == t 47 - + !t 48 - | 49 - - t != false 50 - + t 51 - | 52 - - false != t 53 - + t 54 - ) 55 - 56 - @depends on patch disable is_zero, isnt_zero@ 57 - bool t; 58 - @@ 59 - 60 - ( 61 - - t == 1 62 - + t 63 - | 64 - - t != 1 65 - + !t 66 - | 67 - - t == 0 68 - + !t 69 - | 70 - - t != 0 71 - + t 72 - ) 73 - 74 - @depends on patch && boolok@ 75 - bool b; 76 - @@ 77 - ( 78 - b = 79 - - 0 80 - + false 81 - | 82 - b = 83 - - 1 84 - + true 85 - ) 86 - 87 - // --------------------------------------------------------------------- 88 - 89 - @r1 depends on !patch@ 90 - bool t; 91 - position p; 92 - @@ 93 - 94 - ( 95 - * t@p == true 96 - | 97 - * true == t@p 98 - | 99 - * t@p != true 100 - | 101 - * true != t@p 102 - | 103 - * t@p == false 104 - | 105 - * false == t@p 106 - | 107 - * t@p != false 108 - | 109 - * false != t@p 110 - ) 111 - 112 - @r2 depends on !patch disable is_zero, isnt_zero@ 113 - bool t; 114 - position p; 115 - @@ 116 - 117 - ( 118 - * t@p == 1 119 - | 120 - * t@p != 1 121 - | 122 - * t@p == 0 123 - | 124 - * t@p != 0 125 - ) 126 - 127 - @r3 depends on !patch && boolok@ 128 - bool b; 129 - position p1; 130 - @@ 131 - ( 132 - *b@p1 = 0 133 - | 134 - *b@p1 = 1 135 - ) 136 - 137 - @r4 depends on !patch@ 138 - bool b; 139 - position p2; 140 - identifier i; 141 - constant c != {0,1}; 142 - @@ 143 - ( 144 - b = i 145 - | 146 - *b@p2 = c 147 - ) 148 - 149 - @script:python depends on org@ 150 - p << r1.p; 151 - @@ 152 - 153 - cocci.print_main("WARNING: Comparison to bool",p) 154 - 155 - @script:python depends on org@ 156 - p << r2.p; 157 - @@ 158 - 159 - cocci.print_main("WARNING: Comparison of 0/1 to bool variable",p) 160 - 161 - @script:python depends on org@ 162 - p1 << r3.p1; 163 - @@ 164 - 165 - cocci.print_main("WARNING: Assignment of 0/1 to bool variable",p1) 166 - 167 - @script:python depends on org@ 168 - p2 << r4.p2; 169 - @@ 170 - 171 - cocci.print_main("ERROR: Assignment of non-0/1 constant to bool variable",p2) 172 - 173 - @script:python depends on report@ 174 - p << r1.p; 175 - @@ 176 - 177 - coccilib.report.print_report(p[0],"WARNING: Comparison to bool") 178 - 179 - @script:python depends on report@ 180 - p << r2.p; 181 - @@ 182 - 183 - coccilib.report.print_report(p[0],"WARNING: Comparison of 0/1 to bool variable") 184 - 185 - @script:python depends on report@ 186 - p1 << r3.p1; 187 - @@ 188 - 189 - coccilib.report.print_report(p1[0],"WARNING: Assignment of 0/1 to bool variable") 190 - 191 - @script:python depends on report@ 192 - p2 << r4.p2; 193 - @@ 194 - 195 - coccilib.report.print_report(p2[0],"ERROR: Assignment of non-0/1 constant to bool variable")
···
+1 -3
scripts/nsdeps
··· 12 exit 1 13 fi 14 15 - SPATCH_REQ_VERSION_NUM=$(echo $SPATCH_REQ_VERSION | ${DIR}/scripts/ld-version.sh) 16 SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') 17 - SPATCH_VERSION_NUM=$(echo $SPATCH_VERSION | ${DIR}/scripts/ld-version.sh) 18 19 - if [ "$SPATCH_VERSION_NUM" -lt "$SPATCH_REQ_VERSION_NUM" ] ; then 20 echo "spatch needs to be version $SPATCH_REQ_VERSION or higher" 21 exit 1 22 fi
··· 12 exit 1 13 fi 14 15 SPATCH_VERSION=$($SPATCH --version | head -1 | awk '{print $3}') 16 17 + if ! { echo "$SPATCH_REQ_VERSION"; echo "$SPATCH_VERSION"; } | sort -CV ; then 18 echo "spatch needs to be version $SPATCH_REQ_VERSION or higher" 19 exit 1 20 fi