Jason A. Donenfeld e8a533cbeb 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>
2022-11-18 02:18:02 +01:00
..
2022-09-26 19:46:26 -07:00
2022-10-03 14:02:53 -07:00
2022-09-26 19:46:16 -07:00
2022-10-03 14:02:53 -07:00
2022-03-23 18:03:08 -07:00
2022-10-03 14:03:04 -07:00
2022-06-16 19:48:30 -07:00
2022-05-13 07:20:09 -07:00
2022-09-26 19:46:09 -07:00
2022-10-03 14:02:43 -07:00
2022-09-26 19:46:09 -07:00
2022-09-26 19:46:28 -07:00
2022-09-26 19:46:26 -07:00
2022-10-03 14:02:45 -07:00
2022-10-03 14:02:51 -07:00
2022-10-03 14:02:45 -07:00
2022-01-15 16:30:31 +02:00