* [PATCH 0/7] coccinelle: fix rules that match outdated function names
@ 2026-08-23 16:18 Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 1/7] coccinelle: remove obsolete pci_free_consistent.cocci Sang-Heon Jeon
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
Several scripts still list functions that no longer exist in the tree,
so those rules can never match.
Patches 1-6 remove those functions from the scripts.
Patch 7 replaces dev_put_track() and dev_hold_track() with
netdev_put() and netdev_hold(). I will send separate patches for the
two new reports.
Sang-Heon Jeon (7):
coccinelle: remove obsolete pci_free_consistent.cocci
coccinelle: alloc_cast: drop removed allocators
coccinelle: zalloc-simple: drop the kmem_alloc rules
coccinelle: pool_zalloc-simple: drop the pci_pool_alloc rules
coccinelle: kfree_mismatch: drop vmalloc_exec
coccinelle: atomic_as_refcounter: drop atomic_long_dec_and_lock
coccinelle: ifnulldev_put: update outdated helper names
scripts/coccinelle/api/alloc/alloc_cast.cocci | 20 +++----
.../api/alloc/pool_zalloc-simple.cocci | 17 ++----
.../coccinelle/api/alloc/zalloc-simple.cocci | 41 +-------------
.../coccinelle/api/atomic_as_refcounter.cocci | 4 --
scripts/coccinelle/api/kfree_mismatch.cocci | 12 ++---
scripts/coccinelle/free/ifnulldev_put.cocci | 8 +--
.../coccinelle/free/pci_free_consistent.cocci | 53 -------------------
7 files changed, 22 insertions(+), 133 deletions(-)
delete mode 100644 scripts/coccinelle/free/pci_free_consistent.cocci
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/7] coccinelle: remove obsolete pci_free_consistent.cocci
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators Sang-Heon Jeon
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
pci_alloc_consistent() and pci_free_consistent() were removed by commit
7968778914e5 ("PCI: Remove the deprecated "pci-dma-compat.h" API").
So remove the obsolete script.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
.../coccinelle/free/pci_free_consistent.cocci | 53 -------------------
1 file changed, 53 deletions(-)
delete mode 100644 scripts/coccinelle/free/pci_free_consistent.cocci
diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/pci_free_consistent.cocci
deleted file mode 100644
index e062b9ba09ff..000000000000
--- a/scripts/coccinelle/free/pci_free_consistent.cocci
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/// Find missing pci_free_consistent for every pci_alloc_consistent.
-///
-// Confidence: Moderate
-// Copyright: (C) 2013 Petr Strnad.
-// URL: https://coccinelle.gitlabpages.inria.fr/website
-// Keywords: pci_free_consistent, pci_alloc_consistent
-// Options: --no-includes --include-headers
-
-virtual report
-virtual org
-
-@search@
-local idexpression id;
-expression x,y,z,e;
-position p1,p2;
-type T;
-@@
-
-id = pci_alloc_consistent@p1(x,y,&z)
-... when != e = id
-if (id == NULL || ...) { ... return ...; }
-... when != pci_free_consistent(x,y,id,z)
- when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
- when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
- when != e = (T)id
- when exists
-(
-return 0;
-|
-return 1;
-|
-return id;
-|
-return@p2 ...;
-)
-
-@script:python depends on report@
-p1 << search.p1;
-p2 << search.p2;
-@@
-
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
-coccilib.report.print_report(p2[0],msg)
-
-@script:python depends on org@
-p1 << search.p1;
-p2 << search.p2;
-@@
-
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
-cocci.print_main(msg,p1)
-cocci.print_secs("",p2)
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 1/7] coccinelle: remove obsolete pci_free_consistent.cocci Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 19:31 ` Julia Lawall
2026-08-23 16:18 ` [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules Sang-Heon Jeon
` (4 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
- pci_alloc_consistent() and pci_zalloc_consistent() were removed by
commit 7968778914e5
("PCI: Remove the deprecated "pci-dma-compat.h" API")
- kmem_alloc() was removed by commit f078d4ea8276
("xfs: convert kmem_alloc() to kmalloc()")
- kmem_zalloc() was removed by commit 10634530f7ba
("xfs: convert kmem_zalloc() to kzalloc()")
- kmem_zone_alloc() and kmem_zone_zalloc() were removed by commit
bae633a4a283 ("xfs: remove xfs_zone_{alloc,zalloc} helpers")
So drop them from the rules.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
scripts/coccinelle/api/alloc/alloc_cast.cocci | 20 ++++++++-----------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/scripts/coccinelle/api/alloc/alloc_cast.cocci b/scripts/coccinelle/api/alloc/alloc_cast.cocci
index 958c914f8ba6..a4b83cc8ea01 100644
--- a/scripts/coccinelle/api/alloc/alloc_cast.cocci
+++ b/scripts/coccinelle/api/alloc/alloc_cast.cocci
@@ -53,9 +53,8 @@ position p != {m1.p1,m2.p2};
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
- kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
- pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
- kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
+ kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
+ vmalloc_node\|vzalloc_node\)(...)
//----------------------------------------------------------
// For context mode
@@ -76,9 +75,8 @@ type r1.T;
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
- kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
- pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
- kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
+ kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
+ vmalloc_node\|vzalloc_node\)(...)
//----------------------------------------------------------
// For patch mode
@@ -99,9 +97,8 @@ type r1.T;
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
- kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
- pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
- kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
+ kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
+ vmalloc_node\|vzalloc_node\)(...)
//----------------------------------------------------------
// For org and report mode
@@ -116,9 +113,8 @@ position p != {m1.p1,m2.p2};
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
- kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
- pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
- kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
+ kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
+ vmalloc_node\|vzalloc_node\)(...)
@script:python depends on org@
p << r2.p;
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 1/7] coccinelle: remove obsolete pci_free_consistent.cocci Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 19:31 ` Julia Lawall
2026-08-23 16:18 ` [PATCH 4/7] coccinelle: pool_zalloc-simple: drop the pci_pool_alloc rules Sang-Heon Jeon
` (3 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
- kmem_alloc() was removed by commit f078d4ea8276
("xfs: convert kmem_alloc() to kmalloc()")
- kmem_zalloc() was removed by commit 10634530f7ba
("xfs: convert kmem_zalloc() to kzalloc()")
So drop the kmem_alloc rules.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
.../coccinelle/api/alloc/zalloc-simple.cocci | 41 +------------------
1 file changed, 1 insertion(+), 40 deletions(-)
diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index d66c45356691..ae1d39e71e31 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -35,7 +35,7 @@ statement S;
@@
* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
- kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
+ kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|
devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
if ((x==NULL) || ...) S
* memset((T2)x,0,E1);
@@ -88,15 +88,6 @@ statement S;
- x = (T)kmem_cache_alloc(E3,E4);
+ x = (T)kmem_cache_zalloc(E3,E4);
|
-- x = kmem_alloc(E1,E2);
-+ x = kmem_zalloc(E1,E2);
-|
-- x = (T *)kmem_alloc(E1,E2);
-+ x = kmem_zalloc(E1,E2);
-|
-- x = (T)kmem_alloc(E1,E2);
-+ x = (T)kmem_zalloc(E1,E2);
-|
- x = devm_kmalloc(E2,E1,E3);
+ x = devm_kzalloc(E2,E1,E3);
|
@@ -290,36 +281,6 @@ x << r4.x;
msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
coccilib.report.print_report(p[0], msg)
-//-----------------------------------------------------------------
-@r5 depends on org || report@
-type T, T2;
-expression x;
-expression E1,E2;
-statement S;
-position p;
-@@
-
- x = (T)kmem_alloc@p(E1,E2);
- if ((x==NULL) || ...) S
- memset((T2)x,0,E1);
-
-@script:python depends on org@
-p << r5.p;
-x << r5.x;
-@@
-
-msg="%s" % (x)
-msg_safe=msg.replace("[","@(").replace("]",")")
-coccilib.org.print_todo(p[0], msg_safe)
-
-@script:python depends on report@
-p << r5.p;
-x << r5.x;
-@@
-
-msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
-coccilib.report.print_report(p[0], msg)
-
//-----------------------------------------------------------------
@r6 depends on org || report@
type T, T2;
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/7] coccinelle: pool_zalloc-simple: drop the pci_pool_alloc rules
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
` (2 preceding siblings ...)
2026-08-23 16:18 ` [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 5/7] coccinelle: kfree_mismatch: drop vmalloc_exec Sang-Heon Jeon
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
pci_pool_alloc() and pci_pool_zalloc() were removed by commit
88dee3b0efe4 ("PCI: Remove unused pci_pool wrappers").
So drop the pci_pool_alloc rules.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
.../api/alloc/pool_zalloc-simple.cocci | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci b/scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
index 9c61a23b34db..2c36fb70e0ab 100644
--- a/scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
@@ -5,7 +5,7 @@
// Copyright: (C) 2015 Intel Corp.
// Options: --no-includes --include-headers
//
-// Keywords: dma_pool_zalloc, pci_pool_zalloc
+// Keywords: dma_pool_zalloc
//
virtual context
@@ -22,7 +22,7 @@ expression x;
statement S;
@@
-* x = \(dma_pool_alloc\|pci_pool_alloc\)(...);
+* x = dma_pool_alloc(...);
if ((x==NULL) || ...) S
* memset(x,0, ...);
@@ -41,17 +41,6 @@ statement S;
if ((x==NULL) || ...) S
- memset(x,0,...);
-@depends on patch@
-expression x;
-expression a,b,c;
-statement S;
-@@
-
-- x = pci_pool_alloc(a,b,c);
-+ x = pci_pool_zalloc(a,b,c);
- if ((x==NULL) || ...) S
-- memset(x,0,...);
-
//----------------------------------------------------------
// For org and report mode
//----------------------------------------------------------
@@ -63,7 +52,7 @@ statement S;
position p;
@@
- x = @p\(dma_pool_alloc\|pci_pool_alloc\)(a,b,c);
+ x = @p\(dma_pool_alloc\)(a,b,c);
if ((x==NULL) || ...) S
memset(x,0, ...);
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/7] coccinelle: kfree_mismatch: drop vmalloc_exec
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
` (3 preceding siblings ...)
2026-08-23 16:18 ` [PATCH 4/7] coccinelle: pool_zalloc-simple: drop the pci_pool_alloc rules Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 6/7] coccinelle: atomic_as_refcounter: drop atomic_long_dec_and_lock Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 7/7] coccinelle: ifnulldev_put: update outdated helper names Sang-Heon Jeon
6 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
vmalloc_exec() was removed by commit 7a0e27b2a0ce ("mm: remove
vmalloc_exec").
So drop it from the rules.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
scripts/coccinelle/api/kfree_mismatch.cocci | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/coccinelle/api/kfree_mismatch.cocci b/scripts/coccinelle/api/kfree_mismatch.cocci
index d46a9b3eb7b3..bc90d0c071ac 100644
--- a/scripts/coccinelle/api/kfree_mismatch.cocci
+++ b/scripts/coccinelle/api/kfree_mismatch.cocci
@@ -29,7 +29,7 @@ position kok, vok;
} else {
...
E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|
- vzalloc_node\|vmalloc_exec\|vmalloc_32\|
+ vzalloc_node\|vmalloc_32\|
vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|
__vmalloc_node\)(...)@vok
...
@@ -42,7 +42,7 @@ position kok, vok;
if (E == NULL) {
...
E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|
- vzalloc_node\|vmalloc_exec\|vmalloc_32\|
+ vzalloc_node\|vmalloc_32\|
vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|
__vmalloc_node\)(...)@vok
...
@@ -68,7 +68,7 @@ position f != free.fok;
* E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|
* kzalloc_node\|kmalloc_array\|kmalloc_array_node\|
* kcalloc_node\)(...)@a
- ... when != if (...) { ... E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...); ... }
+ ... when != if (...) { ... E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...); ... }
when != is_vmalloc_addr(E)
when any
* \(vfree\|vfree_atomic\|kvfree\)(E)@f
@@ -82,7 +82,7 @@ position f != free.fok;
E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|
kzalloc_node\|kmalloc_array\|kmalloc_array_node\|
kcalloc_node\)(...)@a
- ... when != if (...) { ... E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...); ... }
+ ... when != if (...) { ... E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...); ... }
when != is_vmalloc_addr(E)
when any
- \(vfree\|vfree_atomic\|kvfree\)(E)@f
@@ -95,7 +95,7 @@ position f != free.fok;
@@
* E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|
-* vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|
+* vmalloc_32\|vmalloc_32_user\|__vmalloc\|
* __vmalloc_node_range\|__vmalloc_node\)(...)@a
... when != is_vmalloc_addr(E)
when any
@@ -108,7 +108,7 @@ position f != free.fok;
@@
E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|
- vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|
+ vmalloc_32\|vmalloc_32_user\|__vmalloc\|
__vmalloc_node_range\|__vmalloc_node\)(...)@a
... when != is_vmalloc_addr(E)
when any
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/7] coccinelle: atomic_as_refcounter: drop atomic_long_dec_and_lock
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
` (4 preceding siblings ...)
2026-08-23 16:18 ` [PATCH 5/7] coccinelle: kfree_mismatch: drop vmalloc_exec Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 7/7] coccinelle: ifnulldev_put: update outdated helper names Sang-Heon Jeon
6 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
atomic_long_dec_and_lock() has never existed. So drop it from the rules.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
scripts/coccinelle/api/atomic_as_refcounter.cocci | 4 ----
1 file changed, 4 deletions(-)
diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index bbe5b2932933..af82b9e094aa 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -26,8 +26,6 @@ identifier fname6 =~ ".*call_rcu.*";
atomic_dec_and_test@p1(&(a)->x)
|
atomic_dec_and_lock@p1(&(a)->x, ...)
-|
- atomic_long_dec_and_lock@p1(&(a)->x, ...)
|
atomic_long_dec_and_test@p1(&(a)->x)
|
@@ -69,8 +67,6 @@ identifier fname =~ ".*free.*";
atomic_dec_and_test@p1(&(a)->x)
|
atomic_dec_and_lock@p1(&(a)->x, ...)
-|
- atomic_long_dec_and_lock@p1(&(a)->x, ...)
|
atomic_long_dec_and_test@p1(&(a)->x)
|
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/7] coccinelle: ifnulldev_put: update outdated helper names
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
` (5 preceding siblings ...)
2026-08-23 16:18 ` [PATCH 6/7] coccinelle: atomic_as_refcounter: drop atomic_long_dec_and_lock Sang-Heon Jeon
@ 2026-08-23 16:18 ` Sang-Heon Jeon
6 siblings, 0 replies; 10+ messages in thread
From: Sang-Heon Jeon @ 2026-08-23 16:18 UTC (permalink / raw)
To: Julia Lawall, Nicolas Palix; +Cc: cocci, linux-kernel
dev_put_track() and dev_hold_track() were renamed to netdev_put() and
netdev_hold() by commit d62607c3fe45 ("net: rename reference+tracking
helpers").
So update the names.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
scripts/coccinelle/free/ifnulldev_put.cocci | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/coccinelle/free/ifnulldev_put.cocci b/scripts/coccinelle/free/ifnulldev_put.cocci
index 2bd2e8fae485..adb08252f98d 100644
--- a/scripts/coccinelle/free/ifnulldev_put.cocci
+++ b/scripts/coccinelle/free/ifnulldev_put.cocci
@@ -23,13 +23,13 @@ expression E;
|
dev_put(E);
|
- dev_put_track(E, ...);
+ netdev_put(E, ...);
|
__dev_hold(E);
|
dev_hold(E);
|
- dev_hold_track(E, ...);
+ netdev_hold(E, ...);
)
@r depends on context || report || org @
@@ -38,8 +38,8 @@ position p;
@@
* if (E != NULL)
-* \(__dev_put@p\|dev_put@p\|dev_put_track@p\|__dev_hold@p\|dev_hold@p\|
-* dev_hold_track@p\)(E, ...);
+* \(__dev_put@p\|dev_put@p\|netdev_put@p\|__dev_hold@p\|dev_hold@p\|
+* netdev_hold@p\)(E, ...);
@script:python depends on org@
p << r.p;
--
2.43.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators
2026-08-23 16:18 ` [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators Sang-Heon Jeon
@ 2026-08-23 19:31 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2026-08-23 19:31 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: Nicolas Palix, cocci, linux-kernel
On Mon, 24 Aug 2026, Sang-Heon Jeon wrote:
> - pci_alloc_consistent() and pci_zalloc_consistent() were removed by
> commit 7968778914e5
> ("PCI: Remove the deprecated "pci-dma-compat.h" API")
>
> - kmem_alloc() was removed by commit f078d4ea8276
> ("xfs: convert kmem_alloc() to kmalloc()")
>
> - kmem_zalloc() was removed by commit 10634530f7ba
> ("xfs: convert kmem_zalloc() to kzalloc()")
>
> - kmem_zone_alloc() and kmem_zone_zalloc() were removed by commit
> bae633a4a283 ("xfs: remove xfs_zone_{alloc,zalloc} helpers")
>
> So drop them from the rules.
>
> No functional change.
Applied
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
> scripts/coccinelle/api/alloc/alloc_cast.cocci | 20 ++++++++-----------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/alloc_cast.cocci b/scripts/coccinelle/api/alloc/alloc_cast.cocci
> index 958c914f8ba6..a4b83cc8ea01 100644
> --- a/scripts/coccinelle/api/alloc/alloc_cast.cocci
> +++ b/scripts/coccinelle/api/alloc/alloc_cast.cocci
> @@ -53,9 +53,8 @@ position p != {m1.p1,m2.p2};
> \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
> kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
> dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
> - kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
> - pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
> - kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
> + kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
> + vmalloc_node\|vzalloc_node\)(...)
>
> //----------------------------------------------------------
> // For context mode
> @@ -76,9 +75,8 @@ type r1.T;
> \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
> kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
> dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
> - kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
> - pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
> - kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
> + kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
> + vmalloc_node\|vzalloc_node\)(...)
>
> //----------------------------------------------------------
> // For patch mode
> @@ -99,9 +97,8 @@ type r1.T;
> \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
> kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
> dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
> - kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
> - pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
> - kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
> + kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
> + vmalloc_node\|vzalloc_node\)(...)
>
> //----------------------------------------------------------
> // For org and report mode
> @@ -116,9 +113,8 @@ position p != {m1.p1,m2.p2};
> \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
> kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
> dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
> - kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
> - pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
> - kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
> + kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|
> + vmalloc_node\|vzalloc_node\)(...)
>
> @script:python depends on org@
> p << r2.p;
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules
2026-08-23 16:18 ` [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules Sang-Heon Jeon
@ 2026-08-23 19:31 ` Julia Lawall
0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2026-08-23 19:31 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: Nicolas Palix, cocci, linux-kernel
On Mon, 24 Aug 2026, Sang-Heon Jeon wrote:
> - kmem_alloc() was removed by commit f078d4ea8276
> ("xfs: convert kmem_alloc() to kmalloc()")
>
> - kmem_zalloc() was removed by commit 10634530f7ba
> ("xfs: convert kmem_zalloc() to kzalloc()")
>
> So drop the kmem_alloc rules.
>
> No functional change.
Applied
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---
> .../coccinelle/api/alloc/zalloc-simple.cocci | 41 +------------------
> 1 file changed, 1 insertion(+), 40 deletions(-)
>
> diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> index d66c45356691..ae1d39e71e31 100644
> --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
> @@ -35,7 +35,7 @@ statement S;
> @@
>
> * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
> - kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
> + kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|
> devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
> if ((x==NULL) || ...) S
> * memset((T2)x,0,E1);
> @@ -88,15 +88,6 @@ statement S;
> - x = (T)kmem_cache_alloc(E3,E4);
> + x = (T)kmem_cache_zalloc(E3,E4);
> |
> -- x = kmem_alloc(E1,E2);
> -+ x = kmem_zalloc(E1,E2);
> -|
> -- x = (T *)kmem_alloc(E1,E2);
> -+ x = kmem_zalloc(E1,E2);
> -|
> -- x = (T)kmem_alloc(E1,E2);
> -+ x = (T)kmem_zalloc(E1,E2);
> -|
> - x = devm_kmalloc(E2,E1,E3);
> + x = devm_kzalloc(E2,E1,E3);
> |
> @@ -290,36 +281,6 @@ x << r4.x;
> msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x)
> coccilib.report.print_report(p[0], msg)
>
> -//-----------------------------------------------------------------
> -@r5 depends on org || report@
> -type T, T2;
> -expression x;
> -expression E1,E2;
> -statement S;
> -position p;
> -@@
> -
> - x = (T)kmem_alloc@p(E1,E2);
> - if ((x==NULL) || ...) S
> - memset((T2)x,0,E1);
> -
> -@script:python depends on org@
> -p << r5.p;
> -x << r5.x;
> -@@
> -
> -msg="%s" % (x)
> -msg_safe=msg.replace("[","@(").replace("]",")")
> -coccilib.org.print_todo(p[0], msg_safe)
> -
> -@script:python depends on report@
> -p << r5.p;
> -x << r5.x;
> -@@
> -
> -msg="WARNING: kmem_zalloc should be used for %s, instead of kmem_alloc/memset" % (x)
> -coccilib.report.print_report(p[0], msg)
> -
> //-----------------------------------------------------------------
> @r6 depends on org || report@
> type T, T2;
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-08-23 19:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 16:18 [PATCH 0/7] coccinelle: fix rules that match outdated function names Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 1/7] coccinelle: remove obsolete pci_free_consistent.cocci Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 2/7] coccinelle: alloc_cast: drop removed allocators Sang-Heon Jeon
2026-08-23 19:31 ` Julia Lawall
2026-08-23 16:18 ` [PATCH 3/7] coccinelle: zalloc-simple: drop the kmem_alloc rules Sang-Heon Jeon
2026-08-23 19:31 ` Julia Lawall
2026-08-23 16:18 ` [PATCH 4/7] coccinelle: pool_zalloc-simple: drop the pci_pool_alloc rules Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 5/7] coccinelle: kfree_mismatch: drop vmalloc_exec Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 6/7] coccinelle: atomic_as_refcounter: drop atomic_long_dec_and_lock Sang-Heon Jeon
2026-08-23 16:18 ` [PATCH 7/7] coccinelle: ifnulldev_put: update outdated helper names Sang-Heon Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox