net/802/{garp,mrp}.c: Use prandom_u32_max instead of manual equivalent
Subsystems (2)
RFC PATCH 17/50 net/802/{garp,mrp}.c: Use prandom_u32_max instead of manual equivalent
The previous code was carefully written for efficiency, which is good, but the helper function is more legible.
Signed-off-by George Spelvin <[email protected]>
Cc Aruna-Hewapathirane <[email protected]>
Cc David S. Miller <[email protected]>
--- net/802/garp.c | 2 +- net/802/mrp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/802/garp.c +1 -1
@@ -394,7 +394,7 @@ static void garp_join_timer_arm(struct garp_applicant *app) {unsigned long delay; - delay = (u64 )msecs_to_jiffies (garp_join_time) *prandom_u32 () >>32 ; + delay =prandom_u32_max (msecs_to_jiffies (garp_join_time));mod_timer (&app->join_timer, jiffies + delay); }
net/802/mrp.c +1 -1
@@ -579,7 +579,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app) {unsigned long delay; - delay = (u64 )msecs_to_jiffies (mrp_join_time) *prandom_u32 () >>32 ; + delay =prandom_u32_max (msecs_to_jiffies (mrp_join_time));mod_timer (&app->join_timer, jiffies + delay); }
Signature · 1 line
2.26.0