summaryrefslogtreecommitdiff
path: root/lib/test_printf.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2020-05-29 17:10:09 +0200
committerJoerg Roedel <jroedel@suse.de>2020-05-29 17:10:09 +0200
commit4c201d58cfee8631350888bad9e8bae33e628605 (patch)
treea49a020d48af561d030b7d4869d193148b5a8088 /lib/test_printf.c
parent555fb5ae0f39962417d35e02d77ee9b2c14a5428 (diff)
parent9cb1fd0efd195590b828b9b865421ad345a4a145 (diff)
downloadlinux-next-4c201d58cfee8631350888bad9e8bae33e628605.tar.gz
Merge tag 'v5.7-rc7' into x86/amd
Linux 5.7-rc7
Diffstat (limited to 'lib/test_printf.c')
-rw-r--r--lib/test_printf.c19
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();