| #
958f7fb6 |
| 10-Feb-2026 |
Linus Torvalds <torvalds@linux-foundation.org> |
Merge tag 'kmalloc_obj-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull kmalloc_obj updates from Kees Cook: "Introduce the kmalloc_obj* family of APIs for switching to typ
Merge tag 'kmalloc_obj-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull kmalloc_obj updates from Kees Cook: "Introduce the kmalloc_obj* family of APIs for switching to type-based kmalloc allocations, away from purely size-based allocations. Discussed on lkml, with you, and at Linux Plumbers. It's been in -next for the entire dev cycle.
Before the merge window closes, I'd like to send the treewide change (generated from the Coccinelle script included here), which mechanically converts almost 20k callsites from kmalloc* to kmalloc_obj*:
8007 files changed, 19980 insertions(+), 20838 deletions(-)
This change needed fixes for mismatched types (since now the return type from allocations is a pointer to the requested type, not "void *"), and I've been fixing these over the last 4 releases.
These fixes have mostly been trivial mismatches with const qualifiers or accidentally identical sizes (e.g. same object size: "struct kvec" vs "struct iovec", or differing pointers to pointers), but I did catch one case of too-small allocation.
Summary:
- Introduce kmalloc_obj*() family of type-based allocator APIs
- checkpatch: Suggest kmalloc_obj family for sizeof allocations
- coccinelle: Add kmalloc_objs conversion script"
* tag 'kmalloc_obj-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: coccinelle: Add kmalloc_objs conversion script slab: Introduce kmalloc_flex() and family compiler_types: Introduce __flex_counter() and family checkpatch: Suggest kmalloc_obj family for sizeof allocations slab: Introduce kmalloc_obj() and family
show more ...
|
| #
bdc5071d |
| 04-Dec-2025 |
Kees Cook <kees@kernel.org> |
coccinelle: Add kmalloc_objs conversion script
Finds and converts sized kmalloc-family of allocations into the typed kmalloc_obj-family of allocations.
Link: https://patch.msgid.link/20251203233036
coccinelle: Add kmalloc_objs conversion script
Finds and converts sized kmalloc-family of allocations into the typed kmalloc_obj-family of allocations.
Link: https://patch.msgid.link/20251203233036.3212363-5-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
show more ...
|