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.
Showing the changes to init (1 of 304 files). Show all
Unified · Split
| @@ -514,7 +514,7 @@ static void __init initramfs_test_hdr_hex(struct kunit *test) · 513 unmodified lines | ||
| 514 | 514 | char fdata[] = "this file data will not be unpacked"; |
| 515 | 515 | struct initramfs_test_bufs { |
| 516 | 516 | char cpio_src[(CPIO_HDRLEN + PATH_MAX + 3 + sizeof(fdata)) * 2]; |
| 517 | − } *tbufs = kzalloc(sizeof(struct initramfs_test_bufs), GFP_KERNEL); | |
| 517 | + } *tbufs = kzalloc_obj(struct initramfs_test_bufs); | |
| 518 | 518 | struct initramfs_test_cpio c[] = { { |
| 519 | 519 | .magic = "070701", |
| 520 | 520 | .ino = 1, |