From: Jason A. Donenfeld Date: Fri, 18 Nov 2022 09:47:58 +0000 (+0100) Subject: treewide: use get_random_u32() when possible X-Git-Tag: origin/for-next_2022-11-30~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11d2f5afcf997d6c2c4b915fd51f9d7aed5087c3;p=thirdparty%2Fxfsprogs-dev.git treewide: use get_random_u32() when possible 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 --- 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;