[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160730154244.403-8-jason@lakedaemon.net>
Date: Sat, 30 Jul 2016 15:42:44 +0000
From: Jason Cooper <jason@...edaemon.net>
To: william.c.roberts@...el.com, Yann Droneaud <ydroneaud@...eya.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
kernel-hardening@...ts.openwall.com
Cc: linux@....linux.org.uk, akpm@...ux-foundation.org,
keescook@...omium.org, tytso@....edu, arnd@...db.de,
gregkh@...uxfoundation.org, catalin.marinas@....com,
will.deacon@....com, ralf@...ux-mips.org, benh@...nel.crashing.org,
paulus@...ba.org, mpe@...erman.id.au, davem@...emloft.net,
tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
x86@...nel.org, viro@...iv.linux.org.uk, nnk@...gle.com,
jeffv@...gle.com, dcashman@...roid.com,
Jason Cooper <jason@...edaemon.net>
Subject: [PATCH v2 7/7] random: Remove unused randomize_range()
All call sites for randomize_range have been updated to use the much
simpler and more robust randomize_addr. Remove the now unnecessary
code.
Signed-off-by: Jason Cooper <jason@...edaemon.net>
---
Changes from v1:
- none
drivers/char/random.c | 19 -------------------
include/linux/random.h | 1 -
2 files changed, 20 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 3bedf69546d6..f2a11211bfa2 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1821,25 +1821,6 @@ unsigned long get_random_long(void)
}
EXPORT_SYMBOL(get_random_long);
-/*
- * randomize_range() returns a start address such that
- *
- * [...... <range> .....]
- * start end
- *
- * a <range> with size "len" starting at the return value is inside in the
- * area defined by [start, end], but is otherwise randomized.
- */
-unsigned long
-randomize_range(unsigned long start, unsigned long end, unsigned long len)
-{
- unsigned long range = end - len - start;
-
- if (end <= start + len)
- return 0;
- return PAGE_ALIGN(get_random_int() % range + start);
-}
-
/**
* randomize_addr - Generate a random, page aligned address
* @start: The smallest acceptable address the caller will take.
diff --git a/include/linux/random.h b/include/linux/random.h
index f1ca2fa4c071..1ad877a98186 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -34,7 +34,6 @@ extern const struct file_operations random_fops, urandom_fops;
unsigned int get_random_int(void);
unsigned long get_random_long(void);
-unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
unsigned long randomize_addr(unsigned long start, unsigned long range);
u32 prandom_u32(void);
--
2.9.2
Powered by blists - more mailing lists