Main-line Linux kernel tree http://www.kernel.org
Go to file
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
arch treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
block
certs
crypto treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
Documentation
drivers treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
fs treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
include
init
io_uring
ipc
kernel treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
lib treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
LICENSES
mm treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
net treewide: use get_random_u32_inclusive() when possible 2022-11-18 02:18:02 +01:00
rust
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.