Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_memcat_p.c Create Date:2022-07-28 06:35:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:test_memcat_p_init

Proto:static int __init test_memcat_p_init(void)

Type:int

Parameter:Nothing

25  err = -ENOMEM , total = 0
27  in0 = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
28  If Not in0 Then Return err
31  in1 = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
32  If Not in1 Then Go to err_free_in0
35  When i < Size of each of the NULL-terminated input arrays - 1 cycle
36  in0[i] = kmalloc( size of in0 , GFP_KERNEL)
37  If Not in0[i] Then Go to err_free_elements
40  in1[i] = kmalloc( size of in1 , GFP_KERNEL)
41  If Not in1[i] Then
42  kfree(in0[i])
43  Go to err_free_elements
47  r = r * 725861 % 6599
48  num = r
49  num = -r
50  magic = MAGIC
51  magic = MAGIC
54  in0[i] = in1[i] = NULL
56  out = memcat_p(in0, in1)
57  If Not out Then Go to err_free_all_elements
60  err = -EINVAL
61  When p && i < Size of each of the NULL-terminated input arrays * 2 - 1 cycle
62  total += num
64  If magic != MAGIC Then
65  pr_err("test failed: wrong magic at %d: %u\n", i, magic)
67  Go to err_free_out
71  If total Then
72  pr_err("test failed: expected zero total, got %d\n", total)
73  Go to err_free_out
76  If i != Expected number of non-NULL elements in the output array Then
77  pr_err("test failed: expected output size %d, got %d\n", Expected number of non-NULL elements in the output array , i)
79  Go to err_free_out
82  When i < Size of each of the NULL-terminated input arrays - 1 cycle If out[i] != in0[i] || out[i + Size of each of the NULL-terminated input arrays - 1] != in1[i] Then
84  pr_err("test failed: wrong element order at %d\n", i)
85  Go to err_free_out
88  err = 0
89  pr_info("test passed\n")
91  err_free_out :
92  kfree(out)
93  err_free_all_elements :
94  i = Size of each of the NULL-terminated input arrays
95  err_free_elements :
96  When i >= 0 cycle
97  kfree(in1[i])
98  kfree(in0[i])
101  kfree(in1)
102  err_free_in0 :
103  kfree(in0)
105  Return err