diff options
Diffstat (limited to 'lib/test_printf.c')
| -rw-r--r-- | lib/test_printf.c | 19 | 
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c index 2d9f520d2f27..6b1622f4d7c2 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -214,6 +214,7 @@ test_string(void)  #define PTR_STR "ffff0123456789ab"  #define PTR_VAL_NO_CRNG "(____ptrval____)"  #define ZEROS "00000000"	/* hex 32 zero bits */ +#define ONES "ffffffff"		/* hex 32 one bits */  static int __init  plain_format(void) @@ -245,6 +246,7 @@ plain_format(void)  #define PTR_STR "456789ab"  #define PTR_VAL_NO_CRNG "(ptrval)"  #define ZEROS "" +#define ONES ""  static int __init  plain_format(void) @@ -330,14 +332,28 @@ test_hashed(const char *fmt, const void *p)  	test(buf, fmt, p);  } +/* + * NULL pointers aren't hashed. + */  static void __init  null_pointer(void)  { -	test_hashed("%p", NULL); +	test(ZEROS "00000000", "%p", NULL);  	test(ZEROS "00000000", "%px", NULL);  	test("(null)", "%pE", NULL);  } +/* + * Error pointers aren't hashed. + */ +static void __init +error_pointer(void) +{ +	test(ONES "fffffff5", "%p", ERR_PTR(-11)); +	test(ONES "fffffff5", "%px", ERR_PTR(-11)); +	test("(efault)", "%pE", ERR_PTR(-11)); +} +  #define PTR_INVALID ((void *)0x000000ab)  static void __init @@ -649,6 +665,7 @@ test_pointer(void)  {  	plain();  	null_pointer(); +	error_pointer();  	invalid_pointer();  	symbol_ptr();  	kernel_ptr();  | 
