[PATCH -next 4/5] mm/kmemleak-test: use %px instead of %p in print

From: Chen Jun
Date: Sun Sep 20 2020 - 22:03:12 EST


From: Wei Yongjun <weiyongjun1@xxxxxxxxxx>

Real addresses are used for diagnose issues.
Convert %p with %px to print kernel addresses.

Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
Signed-off-by: Chen Jun <chenjun102@xxxxxxxxxx>
---
mm/kmemleak-test.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/mm/kmemleak-test.c b/mm/kmemleak-test.c
index e19279ff6aa3..75fe1b8c3226 100644
--- a/mm/kmemleak-test.c
+++ b/mm/kmemleak-test.c
@@ -40,25 +40,25 @@ static int __init kmemleak_test_init(void)
pr_info("Kmemleak testing\n");

/* make some orphan objects */
- pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL));
- pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL));
- pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL));
- pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL));
- pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL));
- pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL));
- pr_info("kmalloc(4096) = %p\n", kmalloc(4096, GFP_KERNEL));
- pr_info("kmalloc(4096) = %p\n", kmalloc(4096, GFP_KERNEL));
+ pr_info("kmalloc(32) = %px\n", kmalloc(32, GFP_KERNEL));
+ pr_info("kmalloc(32) = %px\n", kmalloc(32, GFP_KERNEL));
+ pr_info("kmalloc(1024) = %px\n", kmalloc(1024, GFP_KERNEL));
+ pr_info("kmalloc(1024) = %px\n", kmalloc(1024, GFP_KERNEL));
+ pr_info("kmalloc(2048) = %px\n", kmalloc(2048, GFP_KERNEL));
+ pr_info("kmalloc(2048) = %px\n", kmalloc(2048, GFP_KERNEL));
+ pr_info("kmalloc(4096) = %px\n", kmalloc(4096, GFP_KERNEL));
+ pr_info("kmalloc(4096) = %px\n", kmalloc(4096, GFP_KERNEL));
#ifndef CONFIG_MODULES
- pr_info("kmem_cache_alloc(files_cachep) = %p\n",
+ pr_info("kmem_cache_alloc(files_cachep) = %px\n",
kmem_cache_alloc(files_cachep, GFP_KERNEL));
- pr_info("kmem_cache_alloc(files_cachep) = %p\n",
+ pr_info("kmem_cache_alloc(files_cachep) = %px\n",
kmem_cache_alloc(files_cachep, GFP_KERNEL));
#endif
- pr_info("vmalloc(64) = %p\n", vmalloc(64));
- pr_info("vmalloc(64) = %p\n", vmalloc(64));
- pr_info("vmalloc(64) = %p\n", vmalloc(64));
- pr_info("vmalloc(64) = %p\n", vmalloc(64));
- pr_info("vmalloc(64) = %p\n", vmalloc(64));
+ pr_info("vmalloc(64) = %px\n", vmalloc(64));
+ pr_info("vmalloc(64) = %px\n", vmalloc(64));
+ pr_info("vmalloc(64) = %px\n", vmalloc(64));
+ pr_info("vmalloc(64) = %px\n", vmalloc(64));
+ pr_info("vmalloc(64) = %px\n", vmalloc(64));

/*
* Add elements to a list. They should only appear as orphan
@@ -66,7 +66,7 @@ static int __init kmemleak_test_init(void)
*/
for (i = 0; i < 10; i++) {
elem = kzalloc(sizeof(*elem), GFP_KERNEL);
- pr_info("kzalloc(sizeof(*elem)) = %p\n", elem);
+ pr_info("kzalloc(sizeof(*elem)) = %px\n", elem);
if (!elem)
return -ENOMEM;
INIT_LIST_HEAD(&elem->list);
@@ -75,7 +75,7 @@ static int __init kmemleak_test_init(void)

for_each_possible_cpu(i) {
per_cpu(kmemleak_test_pointer, i) = kmalloc(129, GFP_KERNEL);
- pr_info("kmalloc(129) = %p\n",
+ pr_info("kmalloc(129) = %px\n",
per_cpu(kmemleak_test_pointer, i));
}

--
2.25.0