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, Dec 24, 4:23 AM
Unknown Object (File)
Fri, Dec 13, 3:35 AM
Unknown Object (File)
Tue, Dec 3, 3:06 AM
Unknown Object (File)
Nov 19 2024, 7:10 PM
Unknown Object (File)
Nov 18 2024, 5:52 AM
Unknown Object (File)
Nov 18 2024, 4:37 AM
Unknown Object (File)
Nov 18 2024, 4:29 AM
Unknown Object (File)
Nov 18 2024, 4:27 AM

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 51517
Build 48408: 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.