aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/test_printf.c')
-rw-r--r--lib/test_printf.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c
index 250ee864b8b8..359ae4fb1ece 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -239,6 +239,7 @@ plain_format(void)
239#define PTR ((void *)0x456789ab) 239#define PTR ((void *)0x456789ab)
240#define PTR_STR "456789ab" 240#define PTR_STR "456789ab"
241#define PTR_VAL_NO_CRNG "(ptrval)" 241#define PTR_VAL_NO_CRNG "(ptrval)"
242#define ZEROS ""
242 243
243static int __init 244static int __init
244plain_format(void) 245plain_format(void)
@@ -268,7 +269,6 @@ plain_hash_to_buffer(const void *p, char *buf, size_t len)
268 return 0; 269 return 0;
269} 270}
270 271
271
272static int __init 272static int __init
273plain_hash(void) 273plain_hash(void)
274{ 274{
@@ -326,6 +326,24 @@ test_hashed(const char *fmt, const void *p)
326} 326}
327 327
328static void __init 328static void __init
329null_pointer(void)
330{
331 test_hashed("%p", NULL);
332 test(ZEROS "00000000", "%px", NULL);
333 test("(null)", "%pE", NULL);
334}
335
336#define PTR_INVALID ((void *)0x000000ab)
337
338static void __init
339invalid_pointer(void)
340{
341 test_hashed("%p", PTR_INVALID);
342 test(ZEROS "000000ab", "%px", PTR_INVALID);
343 test("(efault)", "%pE", PTR_INVALID);
344}
345
346static void __init
329symbol_ptr(void) 347symbol_ptr(void)
330{ 348{
331} 349}
@@ -571,6 +589,8 @@ static void __init
571test_pointer(void) 589test_pointer(void)
572{ 590{
573 plain(); 591 plain();
592 null_pointer();
593 invalid_pointer();
574 symbol_ptr(); 594 symbol_ptr();
575 kernel_ptr(); 595 kernel_ptr();
576 struct_resource(); 596 struct_resource();