Page MenuHomeFreeBSD

LinuxKPI: add kvmemdup()
ClosedPublic

Authored by bz on May 13 2024, 5:44 PM.
Tags
None
Referenced Files
F172360220: D45181.id138864.diff
Thu, Sep 17, 11:04 PM
F172360197: D45181.id138487.diff
Thu, Sep 17, 11:04 PM
F172347593: D45181.id138556.diff
Thu, Sep 17, 9:24 PM
F172340878: D45181.diff
Thu, Sep 17, 8:30 PM
Unknown Object (File)
Fri, Sep 11, 4:55 PM
Unknown Object (File)
Fri, Sep 11, 12:21 AM
Unknown Object (File)
Wed, Sep 9, 1:39 AM
Unknown Object (File)
Mon, Sep 7, 3:31 PM
Subscribers

Details

Summary

Add kvmemdup() as a variant of kmemdup().
This is used by an updated wireless driver.

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 57688
Build 54576: arc lint + arc unit

Event Timeline

bz requested review of this revision.May 13 2024, 5:44 PM

Do we have our approach documented somewhere? This looks acceptable given that we already #define kvfree(arg) kfree(arg) but it would be good to have that mentioned somewhere.

This revision is now accepted and ready to land.May 14 2024, 1:03 AM

Do we have our approach documented somewhere? This looks acceptable given that we already #define kvfree(arg) kfree(arg) but it would be good to have that mentioned somewhere.

Other than the way we both looked probably not. kvfree() pre-dated me by a few years and given it is in slab.h I am not sure if there is a single place to document this well.

In theory I should probablu duplicate kmemdup and use kvmalloc() so in case someone ever decided to re-define kvmalloc/kvfree we wouldn't notice?

Duplicate the implmentation and add a comment for kvmalloc/kvfree in slab.h

I'll update the proposed commit message locally.

This revision now requires review to proceed.May 14 2024, 11:01 PM

In theory I should probablu duplicate kmemdup and use kvmalloc() so in case someone ever decided to re-define kvmalloc/kvfree we wouldn't notice?

Yeah that's better I think; I was thinking that a comment about us not having a distinction would be sufficient but this is future-proof against someone separating kmalloc from kvmalloc in the future.

This revision is now accepted and ready to land.May 14 2024, 11:25 PM
This revision was automatically updated to reflect the committed changes.