[RFC PATCH v1 46/50] mm/shuffle.c: use get_random_max()

From: George Spelvin
Date: Sat Mar 28 2020 - 12:46:24 EST


Now that we have it, this is an example of where it helps.

Signed-off-by: George Spelvin <lkml@xxxxxxx>
Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
Cc: Qian Cai <cai@xxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
---
mm/shuffle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shuffle.c b/mm/shuffle.c
index b3fe97fd66541..e0ed247f8d907 100644
--- a/mm/shuffle.c
+++ b/mm/shuffle.c
@@ -135,7 +135,7 @@ void __meminit __shuffle_zone(struct zone *z)
* in the zone.
*/
j = z->zone_start_pfn +
- ALIGN_DOWN(get_random_long() % z->spanned_pages,
+ ALIGN_DOWN(get_random_max(z->spanned_pages),
order_pages);
page_j = shuffle_valid_page(j, order);
if (page_j && page_j != page_i)
--
2.26.0