Commit 7425154d authored by Jason Cooper's avatar Jason Cooper Committed by Linus Torvalds

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.

Link: http://lkml.kernel.org/r/20160803233913.32511-8-jason@lakedaemon.netSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Acked-by: default avatarKees Cook <keescook@chromium.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 05c2679e
...@@ -2100,25 +2100,6 @@ unsigned long get_random_long(void) ...@@ -2100,25 +2100,6 @@ unsigned long get_random_long(void)
} }
EXPORT_SYMBOL(get_random_long); 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_page - Generate a random, page aligned address * randomize_page - Generate a random, page aligned address
* @start: The smallest acceptable address the caller will take. * @start: The smallest acceptable address the caller will take.
......
...@@ -34,7 +34,6 @@ extern const struct file_operations random_fops, urandom_fops; ...@@ -34,7 +34,6 @@ extern const struct file_operations random_fops, urandom_fops;
unsigned int get_random_int(void); unsigned int get_random_int(void);
unsigned long get_random_long(void); unsigned long get_random_long(void);
unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
unsigned long randomize_page(unsigned long start, unsigned long range); unsigned long randomize_page(unsigned long start, unsigned long range);
u32 prandom_u32(void); u32 prandom_u32(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment