linux-stable/drivers/net/wireguard
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
..
selftest treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
Makefile wireguard: do not use -O3 2021-06-04 14:25:14 -07:00
allowedips.c wireguard: allowedips: don't corrupt stack when detecting overflow 2022-08-02 13:47:50 -07:00
allowedips.h wireguard: allowedips: free empty intermediate nodes when removing single node 2021-06-04 14:25:14 -07:00
cookie.c
cookie.h
device.c pm/sleep: Add PM_USERSPACE_AUTOSLEEP Kconfig 2022-07-01 10:39:20 +02:00
device.h wireguard: receive: use ring buffer for incoming handshakes 2021-11-29 19:50:50 -08:00
main.c wireguard: main: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-11-29 19:50:30 -08:00
messages.h
netlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-22 13:02:10 -07:00
netlink.h
noise.c lib/crypto: blake2s: move hmac construction into wireguard 2022-01-18 13:03:55 +01:00
noise.h
peer.c net: drop the weight argument from netif_napi_add 2022-09-28 18:57:14 -07:00
peer.h wireguard: peer: allocate in kmem_cache 2021-06-04 14:25:14 -07:00
peerlookup.c
peerlookup.h
queueing.c wireguard: queueing: use CFI-safe ptr_ring cleanup function 2022-03-30 19:14:08 -07:00
queueing.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-02 11:44:56 -08:00
ratelimiter.c wireguard: ratelimiter: use kvcalloc() instead of kvzalloc() 2021-11-29 19:50:50 -08:00
ratelimiter.h
receive.c wireguard: receive: use dev_sw_netstats_rx_add() 2022-06-09 21:53:10 -07:00
send.c wireguard: queueing: get rid of per-peer ring buffers 2021-02-23 15:59:34 -08:00
socket.c wireguard: socket: ignore v6 endpoints when ipv6 is disabled 2022-03-30 19:14:09 -07:00
socket.h
timers.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
timers.h
version.h