treewide: use get_random_u32_inclusive() when possible
These cases were done with this Coccinelle: @@ expression H; expression L; @@ - (get_random_u32_below(H) + L) + get_random_u32_inclusive(L, H + L - 1) @@ expression H; expression L; expression E; @@ get_random_u32_inclusive(L, H - + E - - E ) @@ expression H; expression L; expression E; @@ get_random_u32_inclusive(L, H - - E - + E ) @@ expression H; expression L; expression E; expression F; @@ get_random_u32_inclusive(L, H - - E + F - + E ) @@ expression H; expression L; expression E; expression F; @@ get_random_u32_inclusive(L, H - + E + F - - E ) And then subsequently cleaned up by hand, with several automatic cases rejected if it didn't make sense contextually. Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> # for infiniband Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -3647,7 +3647,7 @@ static void tcp_send_challenge_ack(struct sock *sk)
|
||||
|
||||
WRITE_ONCE(net->ipv4.tcp_challenge_timestamp, now);
|
||||
WRITE_ONCE(net->ipv4.tcp_challenge_count,
|
||||
half + get_random_u32_below(ack_limit));
|
||||
get_random_u32_inclusive(half, ack_limit + half - 1));
|
||||
}
|
||||
count = READ_ONCE(net->ipv4.tcp_challenge_count);
|
||||
if (count > 0) {
|
||||
|
||||
Reference in New Issue
Block a user