Skip to content

Commit 3c202d1

Browse files
committed
prandom: remove prandom_u32_max()
Convert the final two users of prandom_u32_max() that slipped in during 6.2-rc1 to use get_random_u32_below(). Then, with no more users left, we can finally remove the deprecated function. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 41a1585 commit 3c202d1

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

arch/x86/mm/cpu_entry_area.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static __init void init_cea_offsets(void)
3636
unsigned int cea;
3737

3838
again:
39-
cea = prandom_u32_max(max_cea);
39+
cea = get_random_u32_below(max_cea);
4040

4141
for_each_possible_cpu(j) {
4242
if (cea_offset(j) == cea)

include/linux/prandom.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state);
2424
#define prandom_init_once(pcpu_state) \
2525
DO_ONCE(prandom_seed_full_state, (pcpu_state))
2626

27-
/* Deprecated: use get_random_u32_below() instead. */
28-
static inline u32 prandom_u32_max(u32 ep_ro)
29-
{
30-
return get_random_u32_below(ep_ro);
31-
}
32-
3327
/*
3428
* Handle minimum values for seeds
3529
*/

net/ipv4/tcp_plb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb)
9797
return;
9898

9999
pause = READ_ONCE(net->ipv4.sysctl_tcp_plb_suspend_rto_sec) * HZ;
100-
pause += prandom_u32_max(pause);
100+
pause += get_random_u32_below(pause);
101101
plb->pause_until = tcp_jiffies32 + pause;
102102

103103
/* Reset PLB state upon RTO, since an RTO causes a sk_rethink_txhash() call

0 commit comments

Comments
 (0)