aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linaro.org>2018-06-14 18:28:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-14 18:55:25 -0400
commitee410f15b1418f2f4428e79980674c979081bcb7 (patch)
tree5d812a5175222659875e96eb5b4907b8c1133f9a /lib
parent608dbdfb1f0299f4500e56d62b0d84c44dcfa3be (diff)
lib/test_printf.c: call wait_for_random_bytes() before plain %p tests
If the test_printf module is loaded before the crng is initialized, the plain 'p' tests will fail because the printed address will not be hashed and the buffer will contain '(ptrval)' instead. This patch adds a call to wait_for_random_bytes() before plain 'p' tests to make sure the crng is initialized. Link: http://lkml.kernel.org/r/20180604113708.11554-1-thierry.escande@linaro.org Signed-off-by: Thierry Escande <thierry.escande@linaro.org> Acked-by: Tobin C. Harding <me@tobin.cc> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: David Miller <davem@davemloft.net> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_printf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c
index cea592f402ed..b2aa8f514844 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -260,6 +260,13 @@ plain(void)
260{ 260{
261 int err; 261 int err;
262 262
263 /*
264 * Make sure crng is ready. Otherwise we get "(ptrval)" instead
265 * of a hashed address when printing '%p' in plain_hash() and
266 * plain_format().
267 */
268 wait_for_random_bytes();
269
263 err = plain_hash(); 270 err = plain_hash();
264 if (err) { 271 if (err) {
265 pr_warn("plain 'p' does not appear to be hashed\n"); 272 pr_warn("plain 'p' does not appear to be hashed\n");