Page MenuHomeFreeBSD

LinuxKPI: implement get_random_u32_inclusive()
ClosedPublic

Authored by bz on May 16 2023, 9:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 24, 6:56 AM
Unknown Object (File)
Sep 13 2024, 6:40 AM
Unknown Object (File)
Sep 8 2024, 4:59 PM
Unknown Object (File)
Sep 2 2024, 3:28 PM
Unknown Object (File)
Aug 30 2024, 6:36 PM
Unknown Object (File)
Aug 24 2024, 7:54 PM
Unknown Object (File)
Aug 6 2024, 9:02 AM
Unknown Object (File)
Jul 30 2024, 7:48 PM

Details

Summary

Attempt of an implementation of get_random_u32_inclusive().
This is needed by an update for wireless drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51513
Build 48404: arc lint + arc unit

Event Timeline

bz requested review of this revision.May 16 2023, 9:08 PM
sys/compat/linuxkpi/common/include/linux/random.h
62

low and top seem like an odd pair - I'd think low and high, bottom and top, or floor and ceil.

Change function argument names to floor/ceil as suggested by @emaste.

bz marked an inline comment as done.Jun 8 2023, 6:09 PM
hselasky added inline comments.
sys/compat/linuxkpi/common/include/linux/random.h
70

Is there a reason for the while loop? Is zero not valid for "x >> 32" ?

Maybe add:
MPASS(ceil >= floor);

Maybe add a comment showing the reference to the .PDF document explaining the formula ...

What do you think?

sys/compat/linuxkpi/common/include/linux/random.h
70

@emaste : Thanks for the link!

Address review comments.

@emaste, do you think this is okay now?

This revision was not accepted when it landed; it landed in state Needs Review.Aug 7 2023, 1:00 AM
This revision was automatically updated to reflect the committed changes.