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) /// This semantic patch looks for kmalloc etc that are not followed by a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) /// NULL check.  It only gives a report in the case where there is some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) /// error handling code later in the function, which may be helpful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) /// in determining what the error handling code for the call to kmalloc etc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) /// should be.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) // Confidence: High
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) // Copyright: (C) 2010 Nicolas Palix, DIKU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) // Copyright: (C) 2010 Julia Lawall, DIKU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) // Copyright: (C) 2010 Gilles Muller, INRIA/LiP6.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) // URL: http://coccinelle.lip6.fr/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) virtual context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) @withtest@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) expression x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) position p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) identifier f,fld;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) x@p = f(...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ... when != x->fld
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) \(x == NULL \| x != NULL\)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) @fixed depends on context && !org && !report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) expression x,x1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) position p1 != withtest.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) statement S;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) position any withtest.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) identifier f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) *x1@p = f(...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) if (!x1) S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) // ------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) @rfixed depends on (org || report) && !context exists@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) expression x,x1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) position p1 != withtest.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) position p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) statement S;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) position any withtest.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) identifier f;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) x1@p = f@p2(...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) if (!x1) S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) p1 << rfixed.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) p2 << rfixed.p2;
^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) cocci.print_main("alloc call",p1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) cocci.print_secs("possible model",p2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) p1 << rfixed.p1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) p2 << rfixed.p2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) msg = "alloc with no test, possible model on line %s" % (p2[0].line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) coccilib.report.print_report(p1[0],msg)