]> git.baikalelectronics.ru Git - kernel.git/commit
treewide: use get_random_{u8,u16}() when possible, part 2
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 5 Oct 2022 15:23:53 +0000 (17:23 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 11 Oct 2022 23:42:58 +0000 (17:42 -0600)
commitd92adbb8cbe7282de8c5ea842290c4fd71dba92d
treec163930a1808d49fcb6bdcb897f88e3a7f8dc62e
parentc1349d112fc8605f2e56b2dcb905b9161d69fa56
treewide: use get_random_{u8,u16}() when possible, part 2

Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value,
simply use the get_random_{u8,u16}() functions, which are faster than
wasting the additional bytes from a 32-bit value. This was done by hand,
identifying all of the places where one of the random integer functions
was used in a non-32-bit context.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Yury Norov <yury.norov@gmail.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Heiko Carstens <hca@linux.ibm.com> # for s390
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
arch/s390/kernel/process.c
drivers/mtd/nand/raw/nandsim.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
lib/test_vmalloc.c
net/rds/bind.c
net/sched/sch_sfb.c