Page MenuHomeFreeBSD

LinuxKPI: add kmalloc_obj[s], kzalloc_obj[s], and kzalloc_flex
ClosedPublic

Authored by bz on Apr 14 2026, 3:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 8, 1:55 AM
Unknown Object (File)
Thu, May 28, 10:55 PM
Unknown Object (File)
Wed, May 27, 9:04 AM
Unknown Object (File)
Tue, May 26, 5:34 AM
Unknown Object (File)
May 17 2026, 1:45 PM
Unknown Object (File)
May 17 2026, 9:46 AM
Unknown Object (File)
May 16 2026, 10:49 PM
Unknown Object (File)
May 13 2026, 6:17 PM
Subscribers

Details

Summary

Drivers in Linux v7.0 seem to have changed to the new allocation
macros using a sweep. Add the ones I encountered with wireless
drivers so far. They all take an optional argument for a gfp_t,
which default_gfp() deals with.

The plural version "objs" takes an extra nitems argument in addition
to the size. We use size_mul() to possibly detect overflows.

The "flex" version uses an extra variable to track the variable sized
array allocations and if supported by the compiler will use
__builtin_counted_by_ref() to properly track bounds.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable