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

From: Kees Cook

Date: Mon Oct 05 2026 - 20:52:51 EST


On Mon, Oct 05, 2026 at 11:35:16PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Sep 14, 2026 at 03:32:17PM -0700, Kees Cook wrote:
> > Mirroring the type-based allocation now in use for the kmalloc family of
> > APIs, provide the same for the devm_kmalloc family of APIs. This will
> > allow for future plumbing of type information (e.g. alignment) into the
> > underlying allocations. This immediately gains type check on return
> > values (instead of the prior "void *" return type).
> >
> > Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
> > ---
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> > Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> > Cc: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
> > Cc: <driver-core@xxxxxxxxxxxxxxx>
> > Cc: <linux-hardening@xxxxxxxxxxxxxxx>
> > ---
> > include/linux/device/devres.h | 102 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 102 insertions(+)
>
>
> I'm guessing you want this to go through your tree? If so, that's
> great:
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

Awesome; thank you! I'll get it into -next via the hardening tree.

--
Kees Cook