]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
treewide: use get_random_u32() when possible
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 18 Nov 2022 09:47:58 +0000 (10:47 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 21 Nov 2022 14:26:48 +0000 (15:26 +0100)
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 <gregkh@linuxfoundation.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Yury Norov <yury.norov@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz> # for ext4
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> # for sch_cake
Acked-by: Chuck Lever <chuck.lever@oracle.com> # for nfsd
Acked-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> # for thunderbolt
Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs
Acked-by: Helge Deller <deller@gmx.de> # for parisc
Acked-by: Heiko Carstens <hca@linux.ibm.com> # for s390
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/libxfs_priv.h
libxfs/xfs_ialloc.c

index ad920cd9b6dd18b4208a47f40ef12983253ee6f1..883b22948bb1d8a466fb0ce7077a96ac3d3a8af3 100644 (file)
@@ -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()
 
index 18f3dea5f527117df5026078a10e4d45ef3d6b62..e05aa0c11befb6186d0a6f41243f935d0cf54e63 100644 (file)
@@ -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;