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 kernel/kthread.c (1 of 304 files). Show all

Unified · Split

kernel/kthread.c+1−1
@@ -852,7 +852,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask) · 851 unmodified lines
852852 if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))
853853 return -ENOMEM;
854854
855− kthread->preferred_affinity = kzalloc(sizeof(struct cpumask), GFP_KERNEL);
855+ kthread->preferred_affinity = kzalloc_obj(struct cpumask);
856856 if (!kthread->preferred_affinity) {
857857 ret = -ENOMEM;
858858 goto out;

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