|
@@ -224,7 +224,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
|
|
|
remaining = (high - low) + 1;
|
|
|
|
|
|
rand = prandom_u32();
|
|
|
- first = (((u64)rand * remaining) >> 32) + low;
|
|
|
+ first = reciprocal_scale(rand, remaining) + low;
|
|
|
/*
|
|
|
* force rand to be an odd multiple of UDP_HTABLE_SIZE
|
|
|
*/
|
|
@@ -448,7 +448,7 @@ begin:
|
|
|
}
|
|
|
} else if (score == badness && reuseport) {
|
|
|
matches++;
|
|
|
- if (((u64)hash * matches) >> 32 == 0)
|
|
|
+ if (reciprocal_scale(hash, matches) == 0)
|
|
|
result = sk;
|
|
|
hash = next_pseudo_random32(hash);
|
|
|
}
|
|
@@ -529,7 +529,7 @@ begin:
|
|
|
}
|
|
|
} else if (score == badness && reuseport) {
|
|
|
matches++;
|
|
|
- if (((u64)hash * matches) >> 32 == 0)
|
|
|
+ if (reciprocal_scale(hash, matches) == 0)
|
|
|
result = sk;
|
|
|
hash = next_pseudo_random32(hash);
|
|
|
}
|