]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
treewide: use get_random_u32_below() instead of deprecated function
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 15 Mar 2023 14:31:07 +0000 (15:31 +0100)
committerCarlos Maiolino <cem@kernel.org>
Fri, 17 Mar 2023 10:38:46 +0000 (11:38 +0100)
Source kernel commit: 8032bf1233a74627ce69b803608e650f3f35971c

This is a simple mechanical transformation done by:

@@
expression E;
@@
- prandom_u32_max
+ get_random_u32_below
(E)

Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs
Reviewed-by: SeongJae Park <sj@kernel.org> # for damon
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> # for infiniband
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> # for arm
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # for mmc
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_alloc.c
libxfs/xfs_ialloc.c

index 8c2c2e832f5baec22d4db13e3fbc964bffeb63c5..80915ab471adbd66c32431660186eda617ce1af7 100644 (file)
@@ -1512,7 +1512,7 @@ xfs_alloc_ag_vextent_lastblock(
 
 #ifdef DEBUG
        /* Randomly don't execute the first algorithm. */
-       if (prandom_u32_max(2))
+       if (get_random_u32_below(2))
                return 0;
 #endif
 
index e05aa0c11befb6186d0a6f41243f935d0cf54e63..fe7a689a6cf8e16c978a25a2609a552f7f438339 100644 (file)
@@ -631,7 +631,7 @@ xfs_ialloc_ag_alloc(
        /* randomly do sparse inode allocations */
        if (xfs_has_sparseinodes(tp->t_mountp) &&
            igeo->ialloc_min_blks < igeo->ialloc_blks)
-               do_sparse = prandom_u32_max(2);
+               do_sparse = get_random_u32_below(2);
 #endif
 
        /*