Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /// Many iterators have the property that the first argument is always bound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) /// to a real list element, never NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) //# False positives arise for some iterators that do not have this property,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) //# or in cases when the loop cursor is reassigned.  The latter should only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) //# happen when the matched code is on the way to a loop exit (break, goto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) //# or return).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) // Confidence: Moderate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) // Copyright: (C) 2010-2012 Nicolas Palix.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) // Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) // Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) // URL: http://coccinelle.lip6.fr/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) virtual patch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) virtual context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) @depends on patch@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) iterator I;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) expression x,E,E1,E2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) statement S,S1,S2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) I(x,...) { <...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) - if (x == NULL && ...) S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) - if (x != NULL || ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)   S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) - (x == NULL) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)   E
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) - (x != NULL) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)   E
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) - (x == NULL && ...) ? E1 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)   E2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) - (x != NULL || ...) ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)   E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) - : E2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) - if (x == NULL && ...) S1 else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)   S2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) - if (x != NULL || ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)   S1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) - else S2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) + BAD(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)   x == NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) + )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) + BAD(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)   x != NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) + )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)   ...> }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) @r depends on !patch exists@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) iterator I;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) expression x,E;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) position p1,p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) *I@p1(x,...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) { ... when != x = E
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *  x@p2 == NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) *  x@p2 != NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)   ... when any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) p1 << r.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) p2 << r.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) cocci.print_main("iterator-bound variable",p1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) cocci.print_secs("useless NULL test",p2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) p1 << r.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) p2 << r.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) msg = "ERROR: iterator variable bound on line %s cannot be NULL" % (p1[0].line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) coccilib.report.print_report(p2[0], msg)