From 11d2f5afcf997d6c2c4b915fd51f9d7aed5087c3 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 18 Nov 2022 10:47:58 +0100 Subject: [PATCH] treewide: use get_random_u32() when possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Source kernel commit: a251c17aa558d8e3128a528af5cf8b9d7caae4fd The prandom_u32() function has been a deprecated inline wrapper around get_random_u32() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. The same also applies to get_random_int(), which is just a wrapper around get_random_u32(). This was done as a basic find and replace. Reviewed-by: Greg Kroah-Hartman Reviewed-by: Kees Cook Reviewed-by: Yury Norov Reviewed-by: Jan Kara # for ext4 Acked-by: Toke Høiland-Jørgensen # for sch_cake Acked-by: Chuck Lever # for nfsd Acked-by: Jakub Kicinski Acked-by: Mika Westerberg # for thunderbolt Acked-by: Darrick J. Wong # for xfs Acked-by: Helge Deller # for parisc Acked-by: Heiko Carstens # for s390 Signed-off-by: Jason A. Donenfeld Signed-off-by: Carlos Maiolino --- libxfs/libxfs_priv.h | 6 +++--- libxfs/xfs_ialloc.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index ad920cd9b..883b22948 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -225,10 +225,10 @@ static inline bool WARN_ON(bool expr) { #define WRITE_ONCE(x, val) ((x) = (val)) /* - * prandom_u32 is used for di_gen inode allocation, it must be zero for libxfs - * or all sorts of badness can occur! + * get_random_u32 is used for di_gen inode allocation, it must be zero for + * libxfs or all sorts of badness can occur! */ -#define prandom_u32() 0 +#define get_random_u32() (0) #define PAGE_SIZE getpagesize() diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 18f3dea5f..e05aa0c11 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -800,7 +800,7 @@ sparse_alloc: * number from being easily guessable. */ error = xfs_ialloc_inode_init(args.mp, tp, NULL, newlen, pag->pag_agno, - args.agbno, args.len, prandom_u32()); + args.agbno, args.len, get_random_u32()); if (error) return error; -- 2.47.3