]> git.itanic.dy.fi Git - linux-stable/commitdiff
prandom: remove prandom_u32_max()
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 10 Oct 2022 02:45:07 +0000 (20:45 -0600)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 20 Dec 2022 02:13:45 +0000 (03:13 +0100)
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 <Jason@zx2c4.com>
arch/x86/mm/cpu_entry_area.c
include/linux/prandom.h
net/ipv4/tcp_plb.c

index 8bb1aa6a7aa3af4f1fb876a825f04efbe1f89a78..7316a822425992efec14fb5598d42f32eac43f6c 100644 (file)
@@ -36,7 +36,7 @@ static __init void init_cea_offsets(void)
                unsigned int cea;
 
 again:
-               cea = prandom_u32_max(max_cea);
+               cea = get_random_u32_below(max_cea);
 
                for_each_possible_cpu(j) {
                        if (cea_offset(j) == cea)
index c94c02ba065cd615a11bf885f86ee2c83c843b17..f2ed5b72b3d6f21c2c893cf37153c8a565456c9c 100644 (file)
@@ -24,12 +24,6 @@ void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state);
 #define prandom_init_once(pcpu_state)                  \
        DO_ONCE(prandom_seed_full_state, (pcpu_state))
 
-/* Deprecated: use get_random_u32_below() instead. */
-static inline u32 prandom_u32_max(u32 ep_ro)
-{
-       return get_random_u32_below(ep_ro);
-}
-
 /*
  * Handle minimum values for seeds
  */
index bb1a08fda113e170cd47d59c5e303d14aa86bad5..4bcf7eff95e390b29603c4f3c358e519ed8bc1aa 100644 (file)
@@ -97,7 +97,7 @@ void tcp_plb_update_state_upon_rto(struct sock *sk, struct tcp_plb_state *plb)
                return;
 
        pause = READ_ONCE(net->ipv4.sysctl_tcp_plb_suspend_rto_sec) * HZ;
-       pause += prandom_u32_max(pause);
+       pause += get_random_u32_below(pause);
        plb->pause_until = tcp_jiffies32 + pause;
 
        /* Reset PLB state upon RTO, since an RTO causes a sk_rethink_txhash() call