Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\kmemleak-test.c Create Date:2022-07-28 16:22:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Some very simple testing. This function needs to be extended for* proper testing.

Proto:static int __init kmemleak_test_init(void)

Type:int

Parameter:Nothing

40  pr_info("Kmemleak testing\n")
43  pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL))
44  pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL))
45  pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL))
46  pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL))
47  pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL))
48  pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL))
49  pr_info("kmalloc(4096) = %p\n", kmalloc(4096, GFP_KERNEL))
50  pr_info("kmalloc(4096) = %p\n", kmalloc(4096, GFP_KERNEL))
57  pr_info("vmalloc(64) = %p\n", vmalloc - allocate virtually contiguous memory*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space.* For tight control over page level allocator and protection flags)
58  pr_info("vmalloc(64) = %p\n", vmalloc - allocate virtually contiguous memory*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space.* For tight control over page level allocator and protection flags)
59  pr_info("vmalloc(64) = %p\n", vmalloc - allocate virtually contiguous memory*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space.* For tight control over page level allocator and protection flags)
60  pr_info("vmalloc(64) = %p\n", vmalloc - allocate virtually contiguous memory*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space.* For tight control over page level allocator and protection flags)
61  pr_info("vmalloc(64) = %p\n", vmalloc - allocate virtually contiguous memory*@size: allocation size* Allocate enough pages to cover @size from the page level* allocator and map them into contiguous kernel virtual space.* For tight control over page level allocator and protection flags)
67  When i < 10 cycle
68  elem = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
69  pr_info("kzalloc(sizeof(*elem)) = %p\n", elem)
70  If Not elem Then Return -ENOMEM
72  Initialization list head
73  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
76  for_each_possible_cpu(i)
77  per_cpu(kmemleak_test_pointer, i) = kmalloc(129, GFP_KERNEL)
78  pr_info("kmalloc(129) = %p\n", per_cpu(kmemleak_test_pointer, i))
82  Return 0