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) /// NULL check before some freeing functions is not needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) /// Based on checkpatch warning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) /// "kfree(NULL) is safe this check is probably not required"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) /// and kfreeaddr.cocci by Julia Lawall.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) // Copyright: (C) 2014 Fabian Frederick.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) // Comments: -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) virtual patch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) virtual context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) @r2 depends on patch@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) expression E;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) - if (E != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)   kfree(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)   kvfree(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)   kfree_sensitive(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)   kvfree_sensitive(E, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)   vfree(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)   debugfs_remove(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)   debugfs_remove_recursive(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)   usb_free_urb(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)   kmem_cache_destroy(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)   mempool_destroy(E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)   dma_pool_destroy(E);
^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) @r depends on context || report || org @
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) expression E;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) position p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * if (E != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) *	\(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *         debugfs_remove@p\|debugfs_remove_recursive@p\|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) *         usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) *         dma_pool_destroy@p\)(E, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) cocci.print_main("NULL check before that freeing function is not needed", p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) msg = "WARNING: NULL check before some freeing functions is not needed."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) coccilib.report.print_report(p[0], msg)