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*:
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