Skip to content

random32: Various minor cleanups

George Spelvin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 23 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7lib/random32.c: Mark self-test data as __initconstlib/random32.c+2 -21 reply
2/7lib/random32.c: Remove excess calls to prandom_u32_state in initializationlib/random32.c+8 -132 replies
3/7lib/random32.c: Replace an #ifdef with a stub prandom_state_selftest()lib/random32.c+2 -22 replies
4/7lib/random32.c: Use <asm/unaligned.h> instead of hand-rolling itlib/random32.c+11 -124 replies
5/7lib/random32.c: Make prandom_u32_max efficient for powers of 2include/linux/random.h+13 -16 replies
6/7lib/random32.c: Randomize timeout to the millisecond, not the secondlib/random32.c+3 -35 replies
7/7lib/random32.c: Remove redundant U suffixes on integerslib/random32.c+5 -63 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchDaniel Borkmann
1/7A-b
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] random32: Various minor cleanups

I was looking for self-test code to emulate for lib/glob.c and, while canvassing other code with self-tests, found some code that made me itch, so I scratched it.

7 patches;

1/7: Mark the self-test data as __initconst
2/7: Remove excess calls to prandom_u32_state in initialization 3/7: Replace an #ifdef with a stub prandom_state_selftest() 4/7: Use <asm/unaligned.h> instead of hand-rolling it 5/7: Make prandom_u32_max efficient for powers of 2 6/7: Randomize timeout to the millisecond, not the second 7/7: Remove redundant U suffixes on integers

I have a big follow-on patch series to replace all the (many) instances of "prandom_u32() % x" in the kernel with prandom_u32_max(x), which is more efficient.

As of patch 5/7, "prandom_u32() & (x-1)" can also be replaced by "prandom_u32_max(x)", but that's optional.

Patch 6/7 is dubious, and I'd like comments. I just don't see a reason why integer granularity would be desirable.