[PATCH 0/2] devres: Provide kmalloc_obj*-style API for devm_kmalloc

From: Kees Cook

Date: Mon Sep 14 2026 - 18:35:21 EST


Hi,

As a continuation of the type-based allocator work, this introduces the
wrappers for devm_kmalloc()-family to use the _obj/_objs/_flex API that
the kmalloc()-family has moved to. Along with the coming changes to
scripts/coccinelle/api/kmalloc_objs.cocci to support devm_kmalloc()
conversions, this will result in the following uses:

6644 devm_kzalloc_obj()
1714 devm_kzalloc_objs()
296 devm_kzalloc_flex()
89 devm_kmalloc_objs()
83 devm_kmalloc_obj()
2 devm_kmalloc_flex()

which totals out in diffstat to:

5908 files changed, 10013 insertions(+), 12082 deletions(-)

-Kees

Kees Cook (2):
mm: Move default_gfp() into gfp_types.h
devres: Provide kmalloc_obj*-style API for devm_kmalloc

include/linux/device/devres.h | 102 ++++++++++++++++++++++++++++++++++
include/linux/gfp.h | 4 --
include/linux/gfp_types.h | 4 ++
3 files changed, 106 insertions(+), 4 deletions(-)

--
2.34.1