Skip to content

Commit 7425154

Browse files
Jason Coopertorvalds
authored andcommitted
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.net Signed-off-by: Jason Cooper <jason@lakedaemon.net> Acked-by: Kees Cook <keescook@chromium.org> Cc: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 05c2679 commit 7425154

2 files changed

Lines changed: 0 additions & 20 deletions

File tree

‎drivers/char/random.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,25 +2100,6 @@ unsigned long get_random_long(void)
21002100
}
21012101
EXPORT_SYMBOL(get_random_long);
21022102

2103-
/*
2104-
* randomize_range() returns a start address such that
2105-
*
2106-
* [...... <range> .....]
2107-
* start end
2108-
*
2109-
* a <range> with size "len" starting at the return value is inside in the
2110-
* area defined by [start, end], but is otherwise randomized.
2111-
*/
2112-
unsigned long
2113-
randomize_range(unsigned long start, unsigned long end, unsigned long len)
2114-
{
2115-
unsigned long range = end - len - start;
2116-
2117-
if (end <= start + len)
2118-
return 0;
2119-
return PAGE_ALIGN(get_random_int() % range + start);
2120-
}
2121-
21222103
/**
21232104
* randomize_page - Generate a random, page aligned address
21242105
* @start: The smallest acceptable address the caller will take.

‎include/linux/random.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ extern const struct file_operations random_fops, urandom_fops;
3434

3535
unsigned int get_random_int(void);
3636
unsigned long get_random_long(void);
37-
unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
3837
unsigned long randomize_page(unsigned long start, unsigned long range);
3938

4039
u32 prandom_u32(void);

0 commit comments

Comments
 (0)