From c604b40728c28ba4d831832c7f03805aba11a8e2 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 16 Feb 2018 23:07:03 +0200 Subject: lib/test_printf: Mark big constant with UL Sparse complains that constant is so big for unsigned long on 64-bit architecture. lib/test_printf.c:217:54: warning: constant 0xffff0123456789ab is so big it is unsigned long lib/test_printf.c:246:54: warning: constant 0xffff0123456789ab is so big it is unsigned long To satisfy everyone, mark the constant with UL. Link: http://lkml.kernel.org/r/20180216210711.79901-1-andriy.shevchenko@linux.intel.com To: "Tobin C . Harding" To: linux@rasmusvillemoes.dk To: Joe Perches To: linux-kernel@vger.kernel.org To: Andrew Morton Signed-off-by: Andy Shevchenko [pmladek@suse.com: Changed from ULL to UL as suggested by Luc Van Oostenryck ] Signed-off-by: Petr Mladek --- lib/test_printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/test_printf.c') diff --git a/lib/test_printf.c b/lib/test_printf.c index 71ebfa43ad05..cea592f402ed 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -204,7 +204,7 @@ test_string(void) #if BITS_PER_LONG == 64 #define PTR_WIDTH 16 -#define PTR ((void *)0xffff0123456789ab) +#define PTR ((void *)0xffff0123456789abUL) #define PTR_STR "ffff0123456789ab" #define ZEROS "00000000" /* hex 32 zero bits */ -- cgit From ee410f15b1418f2f4428e79980674c979081bcb7 Mon Sep 17 00:00:00 2001 From: Thierry Escande Date: Thu, 14 Jun 2018 15:28:15 -0700 Subject: 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 Acked-by: Tobin C. Harding Reviewed-by: Andrew Morton Cc: David Miller Cc: Rasmus Villemoes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/test_printf.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/test_printf.c') 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) { int err; + /* + * Make sure crng is ready. Otherwise we get "(ptrval)" instead + * of a hashed address when printing '%p' in plain_hash() and + * plain_format(). + */ + wait_for_random_bytes(); + err = plain_hash(); if (err) { pr_warn("plain 'p' does not appear to be hashed\n"); -- cgit