diff options
Diffstat (limited to 'lib/test_printf.c')
-rw-r--r-- | lib/test_printf.c | 22 |
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 | ||
243 | static int __init | 244 | static int __init |
244 | plain_format(void) | 245 | plain_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 | |||
272 | static int __init | 272 | static int __init |
273 | plain_hash(void) | 273 | plain_hash(void) |
274 | { | 274 | { |
@@ -326,6 +326,24 @@ test_hashed(const char *fmt, const void *p) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | static void __init | 328 | static void __init |
329 | null_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 | |||
338 | static void __init | ||
339 | invalid_pointer(void) | ||
340 | { | ||
341 | test_hashed("%p", PTR_INVALID); | ||
342 | test(ZEROS "000000ab", "%px", PTR_INVALID); | ||
343 | test("(efault)", "%pE", PTR_INVALID); | ||
344 | } | ||
345 | |||
346 | static void __init | ||
329 | symbol_ptr(void) | 347 | symbol_ptr(void) |
330 | { | 348 | { |
331 | } | 349 | } |
@@ -571,6 +589,8 @@ static void __init | |||
571 | test_pointer(void) | 589 | test_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(); |