diff options
author | Sven Eckelmann <sven@narfation.org> | 2020-04-13 21:23:29 +0200 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2020-04-21 10:07:31 +0200 |
commit | 26893e7e928e1790852b072edb9bff3c1309e111 (patch) | |
tree | d52f2653a1ea2c3ae24f44106156630c4db7263c /net/batman-adv/bat_v_elp.c | |
parent | 9204a4f876b229505f4ab947124d1160b80bbb4c (diff) |
batman-adv: Utilize prandom_u32_max for random [0, max) values
The kernel provides a function to create random values from 0 - (max-1)
since commit f337db64af05 ("random32: add prandom_u32_max and convert open
coded users"). Simply use this function to replace code sections which use
prandom_u32 and a handcrafted method to map it to the correct range.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/bat_v_elp.c')
-rw-r--r-- | net/batman-adv/bat_v_elp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index 1e3172db7492..353e49c40e7f 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -49,7 +49,7 @@ static void batadv_v_elp_start_timer(struct batadv_hard_iface *hard_iface) unsigned int msecs; msecs = atomic_read(&hard_iface->bat_v.elp_interval) - BATADV_JITTER; - msecs += prandom_u32() % (2 * BATADV_JITTER); + msecs += prandom_u32_max(2 * BATADV_JITTER); queue_delayed_work(batadv_event_workqueue, &hard_iface->bat_v.elp_wq, msecs_to_jiffies(msecs)); |