[PATCH 06/24] treewide: use get_random_u32() when possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason A. Donenfeld <Jason@xxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
Reviewed-by: Yury Norov <yury.norov@xxxxxxxxx>
Reviewed-by: Jan Kara <jack@xxxxxxx>
Acked-by: Toke Høiland-Jørgensen <toke@xxxxxxx>
Acked-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
Acked-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Acked-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx>
Acked-by: Helge Deller <deller@xxxxxx>
Acked-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
---
 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 b2c3f694b0..ad4b947583 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 18f3dea5f5..e05aa0c11b 100644
--- a/libxfs/xfs_ialloc.c
+++ b/libxfs/xfs_ialloc.c
@@ -800,7 +800,7 @@ xfs_ialloc_ag_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;




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux