diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2012-12-17 19:04:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:26 -0500 |
commit | 496f2f93b1cc286f5a4f4f9acdc1e5314978683f (patch) | |
tree | 464fa6bd115ad4e3bedc02a0b0796a9f9e055ccc /lib/interval_tree_test_main.c | |
parent | 31279b1457f992f24eee8d45ddd647f5fce42cf6 (diff) |
random32: rename random32 to prandom
This renames all random32 functions to have 'prandom_' prefix as follows:
void prandom_seed(u32 seed); /* rename from srandom32() */
u32 prandom_u32(void); /* rename from random32() */
void prandom_seed_state(struct rnd_state *state, u64 seed);
/* rename from prandom32_seed() */
u32 prandom_u32_state(struct rnd_state *state);
/* rename from prandom32() */
The purpose of this renaming is to prevent some kernel developers from
assuming that prandom32() and random32() might imply that only
prandom32() was the one using a pseudo-random number generator by
prandom32's "p", and the result may be a very embarassing security
exposure. This concern was expressed by Theodore Ts'o.
And furthermore, I'm going to introduce new functions for getting the
requested number of pseudo-random bytes. If I continue to use both
prandom32 and random32 prefixes for these functions, the confusion
is getting worse.
As a result of this renaming, "prandom_" is the common prefix for
pseudo-random number library.
Currently, srandom32() and random32() are preserved because it is
difficult to rename too many users at once.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Robert Love <robert.w.love@intel.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Cc: David Laight <david.laight@aculab.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/interval_tree_test_main.c')
-rw-r--r-- | lib/interval_tree_test_main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/interval_tree_test_main.c b/lib/interval_tree_test_main.c index b25903987f7a..245900b98c8e 100644 --- a/lib/interval_tree_test_main.c +++ b/lib/interval_tree_test_main.c | |||
@@ -30,7 +30,8 @@ static void init(void) | |||
30 | { | 30 | { |
31 | int i; | 31 | int i; |
32 | for (i = 0; i < NODES; i++) { | 32 | for (i = 0; i < NODES; i++) { |
33 | u32 a = prandom32(&rnd), b = prandom32(&rnd); | 33 | u32 a = prandom_u32_state(&rnd); |
34 | u32 b = prandom_u32_state(&rnd); | ||
34 | if (a <= b) { | 35 | if (a <= b) { |
35 | nodes[i].start = a; | 36 | nodes[i].start = a; |
36 | nodes[i].last = b; | 37 | nodes[i].last = b; |
@@ -40,7 +41,7 @@ static void init(void) | |||
40 | } | 41 | } |
41 | } | 42 | } |
42 | for (i = 0; i < SEARCHES; i++) | 43 | for (i = 0; i < SEARCHES; i++) |
43 | queries[i] = prandom32(&rnd); | 44 | queries[i] = prandom_u32_state(&rnd); |
44 | } | 45 | } |
45 | 46 | ||
46 | static int interval_tree_test_init(void) | 47 | static int interval_tree_test_init(void) |
@@ -51,7 +52,7 @@ static int interval_tree_test_init(void) | |||
51 | 52 | ||
52 | printk(KERN_ALERT "interval tree insert/remove"); | 53 | printk(KERN_ALERT "interval tree insert/remove"); |
53 | 54 | ||
54 | prandom32_seed(&rnd, 3141592653589793238ULL); | 55 | prandom_seed_state(&rnd, 3141592653589793238ULL); |
55 | init(); | 56 | init(); |
56 | 57 | ||
57 | time1 = get_cycles(); | 58 | time1 = get_cycles(); |