Skip to content

Commit b70fa3b

Browse files
committed
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>
1 parent 8e7f37f commit b70fa3b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mm/util.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,12 @@ int __weak memcmp_pages(struct page *page1, struct page *page2)
997997
void mem_dump_obj(void *object)
998998
{
999999
if (!virt_addr_valid(object)) {
1000-
pr_cont(" non-paged (local) memory.\n");
1000+
if (object == NULL)
1001+
pr_cont(" NULL pointer.\n");
1002+
else if (object == ZERO_SIZE_PTR)
1003+
pr_cont(" zero-size pointer.\n");
1004+
else
1005+
pr_cont(" non-paged (local) memory.\n");
10011006
return;
10021007
}
10031008
if (kmem_valid_obj(object)) {

0 commit comments

Comments
 (0)