History

treewide: refresh kmalloc_obj() conversions

This is another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci This catches both the set of kmalloc() uses added since the first kmalloc_obj() conversions in v7.0 and adds a large group missed in the first pass due to Coccinelle not interacting well with the cleanup.h scoped_...() family of macros[1]. I worked around this with spatch's "--macro-file" argument to a file with all the scoped_...() macros mapped to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control flow indicator I could find. Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc, riscv, and s390 with no new warnings.

Kees Cook committed 2 months ago

Commit 3a2c4d51 parent 90feea3304 files · +637 −726Browse files

Showing the changes to lib/test_workqueue.c (1 of 304 files). Show all

Unified · Split

lib/test_workqueue.c+2−2
@@ -149,11 +149,11 @@ static int __init run_bench(int n_threads, const char *scope, const char *label) · 148 unmodified lines
149 if (ret)149 if (ret)
150 return ret;150 return ret;
151 151
152 ctxs = kcalloc(n_threads, sizeof(*ctxs), GFP_KERNEL);152 ctxs = kzalloc_objs(*ctxs, n_threads);
153 if (!ctxs)153 if (!ctxs)
154 return -ENOMEM;154 return -ENOMEM;
155 155
156 tasks = kcalloc(n_threads, sizeof(*tasks), GFP_KERNEL);156 tasks = kzalloc_objs(*tasks, n_threads);
157 if (!tasks) {157 if (!tasks) {
158 kfree(ctxs);158 kfree(ctxs);
159 return -ENOMEM;159 return -ENOMEM;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t