__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
// SPDX-License-Identifier: GPL-2.0-only
/// NULL check before some freeing functions is not needed.
///
/// Based on checkpatch warning
/// "kfree(NULL) is safe this check is probably not required"
/// and kfreeaddr.cocci by Julia Lawall.
///
// Copyright: (C) 2014 Fabian Frederick.
// Comments: -
// Options: --no-includes --include-headers
virtual patch
virtual org
virtual report
virtual context
@r2 depends on patch@
expression E;
@@
- if (E != NULL)
(
kfree(E);
|
kvfree(E);
|
kfree_sensitive(E);
|
kvfree_sensitive(E, ...);
|
vfree(E);
|
debugfs_remove(E);
|
debugfs_remove_recursive(E);
|
usb_free_urb(E);
|
kmem_cache_destroy(E);
|
mempool_destroy(E);
|
dma_pool_destroy(E);
)
@r depends on context || report || org @
expression E;
position p;
@@
* if (E != NULL)
* \(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
* debugfs_remove@p\|debugfs_remove_recursive@p\|
* usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
* dma_pool_destroy@p\)(E, ...);
@script:python depends on org@
p << r.p;
@@
cocci.print_main("NULL check before that freeing function is not needed", p)
@script:python depends on report@
p << r.p;
@@
msg = "WARNING: NULL check before some freeing functions is not needed."
coccilib.report.print_report(p[0], msg)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| clk_put.cocci | File | 1.27 KB | 0644 |
|
| devm_free.cocci | File | 2.53 KB | 0644 |
|
| ifnulldev_put.cocci | File | 1.06 KB | 0644 |
|
| ifnullfree.cocci | File | 1.29 KB | 0644 |
|
| iounmap.cocci | File | 1.28 KB | 0644 |
|
| kfree.cocci | File | 1.83 KB | 0644 |
|
| kfreeaddr.cocci | File | 646 B | 0644 |
|
| pci_free_consistent.cocci | File | 1.28 KB | 0644 |
|
| put_device.cocci | File | 1.3 KB | 0644 |
|