summaryrefslogtreecommitdiffstats
path: root/mm/util.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-12-09 00:26:22 +0100
committerPaul E. McKenney <paulmck@kernel.org>2021-01-23 00:23:57 +0100
commitb70fa3b12fc8d2b870d1ac7fd44da89271eb8705 (patch)
treef68cacbddfff2a6cc7d48b02f1fb06b4576b70db /mm/util.c
parentmm: Add mem_dump_obj() to print source of memory block (diff)
downloadlinux-b70fa3b12fc8d2b870d1ac7fd44da89271eb8705.tar.xz
linux-b70fa3b12fc8d2b870d1ac7fd44da89271eb8705.zip
mm: Make mem_dump_obj() handle NULL and zero-sized pointers
This commit makes mem_dump_obj() call out NULL and zero-sized pointers specially instead of classifying them as non-paged memory. Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: <linux-mm@kvack.org> Reported-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/util.c b/mm/util.c
index da46f9d6c382..92f23d2c1277 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -997,7 +997,12 @@ int __weak memcmp_pages(struct page *page1, struct page *page2)
void mem_dump_obj(void *object)
{
if (!virt_addr_valid(object)) {
- pr_cont(" non-paged (local) memory.\n");
+ if (object == NULL)
+ pr_cont(" NULL pointer.\n");
+ else if (object == ZERO_SIZE_PTR)
+ pr_cont(" zero-size pointer.\n");
+ else
+ pr_cont(" non-paged (local) memory.\n");
return;
}
if (kmem_valid_obj(object)) {