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
F172011870: D56395.id175808.diff
Tue, Sep 15, 9:17 AM
F171972474: D56395.id.diff
Tue, Sep 15, 1:13 AM
Unknown Object (File)
Mon, Sep 14, 6:12 PM
Unknown Object (File)
Tue, Sep 8, 6:42 AM
Unknown Object (File)
Wed, Sep 2, 10:34 AM
Unknown Object (File)
Wed, Sep 2, 10:04 AM
Unknown Object (File)
Wed, Sep 2, 1:10 AM
Unknown Object (File)
Sat, Aug 29, 2:17 AM
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 Passed
Unit
No Test Coverage
Build Status
Buildable 72204
Build 69087: arc lint + arc unit