net/rds/bind.c: Use prandom_u32_max()
Subsystems (3)
RFC PATCH 5/50 net/rds/bind.c: Use prandom_u32_max()
max_t(u16, prandom_u32(), 2) generates 2 three times as often as any other value. Operating modulo 65534 improves uniformity.
Signed-off-by George Spelvin <[email protected]>
Cc Ka-Cheong Poon <[email protected]>
Cc Santosh Shilimkar <[email protected]>
--- net/rds/bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/bind.c +1 -1
@@ -104,7 +104,7 @@ static int rds_add_bound(struct rds_sock *rs, const struct in6_addr *addr,return -EINVAL ; last = rover; }else { - rover =max_t (u16,prandom_u32 (),2 ); + rover =2 +prandom_u32_max (65534 ); last = rover -1 ; }
Signature · 1 line
2.26.0