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)
Mon, Dec 4, 1:37 PM
Unknown Object (File)
Thu, Nov 30, 3:06 PM
Unknown Object (File)
Oct 15 2023, 2:18 AM
Unknown Object (File)
Oct 15 2023, 2:18 AM
Unknown Object (File)
Oct 12 2023, 1:45 AM
Unknown Object (File)
Sep 27 2023, 7:06 AM
Unknown Object (File)
Sep 25 2023, 3:38 AM
Unknown Object (File)
Sep 16 2023, 6:44 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 52368
Build 49259: 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.