* [RFC PATCH v1 49/50] arch/x86/entry/vdso/vma.c: Use get_random_max32() for vdso_addr
@ 2019-11-30 0:05 George Spelvin
0 siblings, 0 replies; only message in thread
From: George Spelvin @ 2019-11-30 0:05 UTC (permalink / raw)
To: linux-kernel, lkml; +Cc: Ingo Molnar, Andy Lutomirski
Which is faster and more uniform than get_random_int() % range.
Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
---
arch/x86/entry/vdso/vma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index f5937742b2901..beb4ef8f85987 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -227,7 +227,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
end -= len;
if (end > start) {
- offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1);
+ offset = get_random_max32(((end - start) >> PAGE_SHIFT) + 1);
addr = start + (offset << PAGE_SHIFT);
} else {
addr = start;
--
2.26.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-28 16:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-30 0:05 [RFC PATCH v1 49/50] arch/x86/entry/vdso/vma.c: Use get_random_max32() for vdso_addr George Spelvin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.