linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: George Spelvin <lkml@sdf.org>
To: linux-kernel@vger.kernel.org, lkml@sdf.org
Cc: Dan Williams <dan.j.williams@intel.com>, Qian Cai <cai@lca.pw>,
	Kees Cook <keescook@chromium.org>, Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: [RFC PATCH v1 46/50] mm/shuffle.c: use get_random_max()
Date: Thu, 3 Oct 2019 05:51:56 -0400	[thread overview]
Message-ID: <202003281643.02SGhPmY017434@sdf.org> (raw)

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

Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Qian Cai <cai@lca.pw>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
---
 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



             reply	other threads:[~2020-03-28 16:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03  9:51 George Spelvin [this message]
2020-03-28 18:23 ` [RFC PATCH v1 46/50] mm/shuffle.c: use get_random_max() Dan Williams
2020-03-28 18:28   ` [RFC PATCH v1 00/52] Audit kernel random number use George Spelvin
2020-03-29 12:21     ` David Laight
2020-03-29 17:41       ` George Spelvin
2020-03-29 21:42         ` Theodore Y. Ts'o
2020-03-30  9:27           ` David Laight
2020-04-01  5:17           ` lib/random32.c security George Spelvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202003281643.02SGhPmY017434@sdf.org \
    --to=lkml@sdf.org \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).